#9138abf601233 Thanks @bluwy! - Updates the unified, remark, and rehype dependencies to latest. Make sure to update your custom remark and rehype plugins as well to be compatible with the latest versions.
Potentially breaking change: The default value of markdown.remarkRehype.footnoteBackLabel is changed from "Back to content" to "Back to reference 1". See the mdast-util-to-hastcommit for more information.
#9182c7953645e Thanks @bluwy! - Removes deprecated APIs. All Astro packages had been refactored to not use these APIs.
#8502c4270e476 Thanks @bluwy! - Updates the internal shiki syntax highlighter to shikiji, 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 shikiji now produces a smaller HTML markup by attaching a fallback color style to the pre or code element, instead of to the line span directly. For example:
This does not affect the colors as the span will inherit the color from the parent, but if you’re relying on a specific HTML markup, please check your site carefully after upgrading to verify the styles.
#693249514e4ce Thanks @bluwy! - Upgrade shiki to v0.14.1. This updates the shiki theme colors and adds the theme name to the pre tag, e.g. <pre class="astro-code github-dark">.
#6555f5fddafc2 Thanks @Princesseuh! - Add a validateOptions hook to the Image Service API in order to set default options and validate the passed options
#5687e2019be6f Thanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This means data.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:
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.
Replace the extendDefaultPlugins option with a gfm boolean and a smartypants 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 or rehypePlugins are configured. If you want to apply custom plugins and remove Astro’s default plugins, manually set gfm: false and smartypants: false in your config.
Migrate extendDefaultPlugins to gfm and smartypants
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 includes syntaxHighlighting and shikiConfig options to further customize the MDX renderer.
Simplify extendPlugins to an extendMarkdownConfig option. MDX options will default to their equivalent in your Markdown config. By setting extendMarkdownConfig to false, you can “eject” to set your own syntax highlighting, plugins, and more.
Migrate MDX’s extendPlugins to extendMarkdownConfig
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 the extendPlugins: 'markdown' option.
gfm (true by default) and smartypants (true by default) to toggle GitHub-Flavored Markdown and SmartyPants in MDX. This replaces the extendPlugins: 'defaults' option.
#582552209ca2a Thanks @bholmesdev! - Baseline the experimental contentCollections flag. You’re free to remove this from your astro config!
This marks astro as a peerDependency of several packages that are already getting major version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
This marks astro as a peerDependency of several packages that are already getting major version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
#576993e633922 Thanks @bholmesdev! - Introduce a smartypants flag 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 extendDefaultPlugins option. This has now been split into 2 flags to disable each plugin individually: