Major Changes
-
#5687
e2019be6f
Thanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatter
is 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
imageSrc
slug 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
remarkPluginFrontmatter
property 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
title
if 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
16107b6a1
Thanks @delucis! - Drop support for legacy Astro-flavored Markdown -
#5684
a9c292026
& #576993e633922
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.-
Markdown
-
Replace the
extendDefaultPlugins
option with agfm
boolean and asmartypants
boolean. 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
remarkPlugins
orrehypePlugins
are configured. If you want to apply custom plugins and remove Astro's default plugins, manually setgfm: false
andsmartypants: false
in your config.
-
-
Migrate
extendDefaultPlugins
togfm
andsmartypants
You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the
extendDefaultPlugins
option. This has now been split into 2 flags to disable each plugin individually:-
markdown.gfm
to disable GitHub-Flavored Markdown -
markdown.smartypants
to disable SmartyPants// astro.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 includessyntaxHighlighting
andshikiConfig
options to further customize the MDX renderer. -
Simplify
extendPlugins
to anextendMarkdownConfig
option. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfig
to false, you can "eject" to set your own syntax highlighting, plugins, and more.
-
-
Migrate MDX's
extendPlugins
toextendMarkdownConfig
You may have used the
extendPlugins
option to manage plugin defaults in MDX. This has been replaced by 3 flags:extendMarkdownConfig
(true
by default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'
option.gfm
(true
by default) andsmartypants
(true
by default) to toggle GitHub-Flavored Markdown and SmartyPants in MDX. This replaces theextendPlugins: 'defaults'
option.
-
-
#5825
52209ca2a
Thanks @bholmesdev! - Baseline the experimentalcontentCollections
flag. You're free to remove this from your astro config!import { defineConfig } from 'astro/config'; export default defineConfig({ - experimental: { contentCollections: true } })
-
#5806
7572f7402
Thanks @matthewp! - Make astro apeerDependency
of integrationsThis marks
astro
as apeerDependency
of several packages that are already gettingmajor
version 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
12f65a4d5
Thanks @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