@astrojs/markdown-remark
🍿 Minor Changes
-
#8502
c4270e476Thanks @bluwy! - Updates the internalshikisyntax highlighter toshikiji, an ESM-focused alternative that simplifies bundling and maintenance.There are no new options and no changes to how you author code blocks and syntax highlighting.
Potentially breaking change: While this refactor should be transparent for most projects, the transition to
shikijinow produces a smaller HTML markup by attaching a fallbackcolorstyle to thepreorcodeelement, instead of to the linespandirectly. For example:Before:
<code class="astro-code" style="background-color: #24292e"><pre><span class="line" style="color: #e1e4e8">my code</span></pre></code>After:
<code class="astro-code" style="background-color: #24292e; color: #e1e4e8"><pre><span class="line">my code<span></pre></code>This does not affect the colors as the
spanwill inherit thecolorfrom the parent, but if you’re relying on a specific HTML markup, please check your site carefully after upgrading to verify the styles.
🐞 Patch Changes
-
✨ Major Changes
-
#8179
6011d52d3Thanks @matthewp! - Astro 3.0 Release Candidate -
#8169
e79e3779dThanks @bluwy! - Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:material-darker->material-theme-darkermaterial-default->material-themematerial-lighter->material-theme-lightermaterial-ocean->material-theme-oceanmaterial-palenight->material-theme-palenight
🐞 Patch Changes
- Updated dependencies [
d0679a666,db39206cb,adf9fccfd,0c7b42dc6,46c4c0e05,364d861bd,2484dc408,81545197a,6011d52d3,c2c71d90c,cd2d7e769,80f1494cd,e45f30293,c0de7a7b0,65c354969,3c3100851,34cb20021,a824863ab,44f7a2872,1048aca55,be6bbd2c8,9e021a91c,7511a4980,c37632a20,acf652fc1,42785c7b7,8450379db,dbc97b121,7d2f311d4,2540feedb,ea7ff5177,68efd4a8b,7bd1b86f8,036388f66,519a1c4e8,1f58a7a1b,2ae9d37f0,a8f35777e,70f34f5a3,5208a3c8f,84af8ed9d,f003e7364,ffc9e2d3d,732111cdc,0f637c71e,33b8910cf,8a5b0c1f3,148e61d24,e79e3779d,632579dc2,3674584e0,1db4e92c1,e7f872e91,16f09dfff,4477bb41c,55c10d1d5,3e834293d,96beb883a,997a0db8a,80f1494cd,0f0625504,e1ae56e72,f32d093a2,f01eb585e,b76c166bd,a87cbe400,866ed4098,767eb6866,32669cd47]:- @astrojs/prism@3.0.0
- astro@3.0.0
-
✨ Major Changes
-
#8179
6011d52d3Thanks @matthewp! - Astro 3.0 Release Candidate -
#8169
e79e3779dThanks @bluwy! - Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:material-darker->material-theme-darkermaterial-default->material-themematerial-lighter->material-theme-lightermaterial-ocean->material-theme-oceanmaterial-palenight->material-theme-palenight
🐞 Patch Changes
-
🐞 Patch Changes
-
#7104
826e02890Thanks @bluwy! - Specify"files"field to only publish necessary files -
Updated dependencies [
4516d7b22,e186ecc5e,c6d7ebefd,914c439bc,e9fc2c221,075eee08f,719002ca5,fc52681ba,fb84622af,cada10a46,cd410c5eb,73ec6f6c1,410428672,763ff2d1e,c1669c001,3d525efc9,826e02890]:- astro@2.5.0
- @astrojs/prism@2.1.2
-
🐞 Patch Changes
-
#6559
90e5f87d0Thanks @Princesseuh! - Vendorimage-sizeto fix CJS-related issues -
#6555
f5fddafc2Thanks @Princesseuh! - Add avalidateOptionshook to the Image Service API in order to set default options and validate the passed options -
Updated dependencies [
04dddd783,ea9b3dd72,bf024cb34,22955b895,f413446a8,90e5f87d0,388190102,035c0c4df,f112c12b1,689884251,fa132e35c,f5fddafc2,283734525,66858f1f2,6c465e958]:- astro@2.1.4
-
🍿 Minor Changes
-
#6344
694918a56Thanks @Princesseuh! - Add a new experimental flag (experimental.assets) to enable our new core Assets story.This unlocks a few features:
- A new built-in image component and JavaScript API to transform and optimize images.
- Relative images with automatic optimization in Markdown.
- Support for validating assets using content collections.
- and more!
See Assets (Experimental) on our docs site for more information on how to use this feature!
-
#6213
afbbc4d5bThanks @Princesseuh! - Updated compilation settings to disable downlevelling for Node 14
🐞 Patch Changes
-
✨ Major Changes
-
#5687
e2019be6fThanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatteris now the complete Markdown or MDX document’s frontmatter, rather than an empty object.This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an
imageSrcslug in your document frontmatter:export function remarkInjectSocialImagePlugin() {return function (tree, file) {const { frontmatter } = file.data.astro;frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname;};}When using Content Collections, you can access this modified frontmatter using the
remarkPluginFrontmatterproperty returned when rendering an entry.Migration instructions
Plugin authors should now check for user frontmatter when applying defaults.
For example, say a remark plugin wants to apply a default
titleif none is present. Add a conditional to check if the property is present, and update if none exists:export function remarkInjectTitlePlugin() {return function (tree, file) {const { frontmatter } = file.data.astro;if (!frontmatter.title) {frontmatter.title = 'Default title';}}}This differs from previous behavior, where a Markdown file’s frontmatter would always override frontmatter injected via remark or reype.
-
#5785
16107b6a1Thanks @delucis! - Drop support for legacy Astro-flavored Markdown -
#5684
a9c292026& #576993e633922Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.-
Markdown
-
Replace the
extendDefaultPluginsoption with agfmboolean and asmartypantsboolean. These are enabled by default, and can be disabled to remove GitHub-Flavored Markdown and SmartyPants. -
Ensure GitHub-Flavored Markdown and SmartyPants are applied whether or not custom
remarkPluginsorrehypePluginsare configured. If you want to apply custom plugins and remove Astro’s default plugins, manually setgfm: falseandsmartypants: falsein your config.
-
-
Migrate
extendDefaultPluginstogfmandsmartypantsYou may have disabled Astro’s built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPluginsoption. This has now been split into 2 flags to disable each plugin individually:-
markdown.gfmto disable GitHub-Flavored Markdown -
markdown.smartypantsto disable SmartyPantsastro.config.mjs import { defineConfig } from 'astro/config';export default defineConfig({markdown: { -
extendDefaultPlugins: false,
-
smartypants: false,
-
gfm: false, } });
Additionally, applying remark and rehype plugins **no longer disables** `gfm` and `smartypants`. You will need to opt-out manually by setting `gfm` and `smartypants` to `false`.
-
-
MDX
-
Support all Markdown configuration options (except
drafts) from your MDX integration config. This includessyntaxHighlightingandshikiConfigoptions to further customize the MDX renderer. -
Simplify
extendPluginsto anextendMarkdownConfigoption. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfigto false, you can “eject” to set your own syntax highlighting, plugins, and more.
-
-
Migrate MDX’s
extendPluginstoextendMarkdownConfigYou may have used the
extendPluginsoption to manage plugin defaults in MDX. This has been replaced by 3 flags:extendMarkdownConfig(trueby default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'option.gfm(trueby default) andsmartypants(trueby default) to toggle GitHub-Flavored Markdown and SmartyPants in MDX. This replaces theextendPlugins: 'defaults'option.
-
-
#5825
52209ca2aThanks @bholmesdev! - Baseline the experimentalcontentCollectionsflag. You’re free to remove this from your astro config!import { defineConfig } from 'astro/config';export default defineConfig({experimental: { contentCollections: true }}) -
#5806
7572f7402Thanks @matthewp! - Make astro apeerDependencyof integrationsThis marks
astroas apeerDependencyof several packages that are already gettingmajorversion bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
Patch Changes
-
#5837
12f65a4d5Thanks @giuseppelt! - fix shiki css class replace logic -
Updated dependencies [
93e633922,16dc36a87,01f3f463b,e2019be6f,05caf445d,49ab4f231,a342a486c,8fb28648f,1f92d64ea,c2180746b,ae8a012a7,cf2de5422,ce5c5dbd4,ec09bb664,665a2c222,259a539d7,f7aa1ec25,4987d6f44,304823811,302e0ef8f,55cea0a9d,dd56c1941,9963c6e4d,be901dc98,f6cf92b48,e818cc046,8c100a6fe,116d8835c,840412128,1f49cddf9,7325df412,16c7d0bfd,a9c292026,2a5786419,4a1cabfe6,a8d3e7924,fa8c131f8,64b8082e7,c4b0cb8bf,23dc9ea96,63a6ceb38,a3a7fc929,52209ca2a,5fd9208d4,5eba34fcc,899214298,3a00ecb3e,5eba34fcc,2303f9514,1ca81c16b,b66d7195c]:- astro@2.0.0
- @astrojs/prism@2.0.0
-
✨ Major Changes
-
#5785
16107b6a1Thanks @delucis! - Drop support for legacy Astro-flavored Markdown -
#5825
52209ca2aThanks @bholmesdev! - Baseline the experimentalcontentCollectionsflag. You’re free to remove this from your astro config!import { defineConfig } from 'astro/config';export default defineConfig({experimental: { contentCollections: true }}) -
#5806
7572f7402Thanks @matthewp! - Make astro a peerDependency of integrationsThis marks
astroas a peerDependency of several packages that are already gettingmajorversion bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
🐞 Patch Changes
-
#5837
12f65a4d5Thanks @giuseppelt! - fix shiki css class replace logic -
Updated dependencies [
01f3f463b,1f92d64ea,c2180746b,ae8a012a7,cf2de5422,ec09bb664,665a2c222,f7aa1ec25,302e0ef8f,840412128,1f49cddf9,4a1cabfe6,c4b0cb8bf,23dc9ea96,63a6ceb38,52209ca2a,2303f9514]:- astro@2.0.0-beta.2
- @astrojs/prism@2.0.0-beta.0
-
🍿 Minor Changes
-
#5769
93e633922Thanks @bholmesdev! - Introduce asmartypantsflag to opt-out of Astro’s default SmartyPants plugin.{markdown: {smartypants: false,}}Migration
You may have disabled Astro’s built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPluginsoption. This has now been split into 2 flags to disable each plugin individually:markdown.gfmto disable GitHub-Flavored Markdownmarkdown.smartypantsto disable SmartyPants
astro.config.mjs import { defineConfig } from 'astro/config';export default defineConfig({markdown: {extendDefaultPlugins: false,smartypants: false,gfm: false,}});
-
✨ Major Changes
-
#5687
e2019be6fThanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatteris now the complete Markdown or MDX document’s frontmatter, rather than an empty object.This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an
imageSrcslug in your document frontmatter:export function remarkInjectSocialImagePlugin() {return function (tree, file) {const { frontmatter } = file.data.astro;frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname;};}Content Collections - new
remarkPluginFrontmatterpropertyWe have changed inject frontmatter to modify frontmatter in our docs to improve discoverability. This is based on support forum feedback, where “injection” is rarely the term used.
To reflect this, the
injectedFrontmatterproperty has been renamed toremarkPluginFrontmatter. This should clarify this plugin is still separate from thedataexport Content Collections expose today.Migration instructions
Plugin authors should now check for user frontmatter when applying defaults.
For example, say a remark plugin wants to apply a default
titleif none is present. Add a conditional to check if the property is present, and update if none exists:export function remarkInjectTitlePlugin() {return function (tree, file) {const { frontmatter } = file.data.astro;if (!frontmatter.title) {frontmatter.title = 'Default title';}}}This differs from previous behavior, where a Markdown file’s frontmatter would always override frontmatter injected via remark or reype.
-
#5684
a9c292026Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.Markdown
- Remove
remark-smartypantsfrom Astro’s default Markdown plugins. - Replace the
extendDefaultPluginsoption with a simplifiedgfmboolean. This is enabled by default, and can be disabled to remove GitHub-Flavored Markdown. - Ensure GitHub-Flavored Markdown is applied whether or not custom
remarkPluginsorrehypePluginsare configured. If you want to apply custom plugins and remove GFM, manually setgfm: falsein your config.
MDX
- Support all Markdown configuration options (except
drafts) from your MDX integration config. This includessyntaxHighlightingandshikiConfigoptions to further customize the MDX renderer. - Simplify
extendDefaultsto anextendMarkdownConfigoption. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfigto false, you can “eject” to set your own syntax highlighting, plugins, and more.
Migration
To preserve your existing Markdown and MDX setup, you may need some configuration changes:
Smartypants manual installation
Smartypants has been removed from Astro’s default setup. If you rely on this plugin, install
remark-smartypantsand apply to yourastro.config.*:astro.config.mjs import { defineConfig } from 'astro/config';import smartypants from 'remark-smartypants';export default defineConfig({markdown: {remarkPlugins: [smartypants],}});Migrate
extendDefaultPluginstogfmYou may have disabled Astro’s built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPluginsoption. Since Smartypants has been removed, this has been renamed togfm.astro.config.mjs import { defineConfig } from 'astro/config';export default defineConfig({markdown: {extendDefaultPlugins: false,gfm: false,}});Additionally, applying remark and rehype plugins no longer disables
gfm. You will need to opt-out manually by settinggfmtofalse.Migrate MDX’s
extendPluginstoextendMarkdownConfigYou may have used the
extendPluginsoption to manage plugin defaults in MDX. This has been replaced by 2 flags:extendMarkdownConfig(trueby default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'option.gfm(trueby default) to toggle GitHub-Flavored Markdown in MDX. This replaces theextendPlugins: 'defaults'option.
- Remove
-
🍿 Minor Changes
-
#5654
2c65b433bThanks @delucis! - Refactor and exportrehypeHeadingIdspluginThe
rehypeHeadingIdsplugin injects IDs for all headings in a Markdown document and can now also handle MDX inputs if needed. You can import and use this plugin if you need heading IDs to be injected before other rehype plugins run.
🐞 Patch Changes
- #5648
853081d1cThanks @bholmesdev! - Prevent relative image paths insrc/content/
-