Fix Astro 7 markdown.rehypePlugins Deprecation Warning

A terminal window showing the real Astro build warning: markdown.remarkPlugins, markdown.rehypePlugins, and markdown.remarkRehype are deprecated, pass them to unified from at astrojs slash markdown-remark directly instead
On this page

Why the warning happens

Astro 7 defaults to Sätteri, a new Rust Markdown processor with no plugin system of its own. Setting markdown.remarkPlugins, markdown.rehypePlugins, or markdown.remarkRehype at the top level tells Astro to fall back to the older @astrojs/markdown-remark unified pipeline instead, since only that pipeline can run remark and rehype plugins at all.

That fallback still works. The top-level config keys used to trigger it are deprecated, in favor of passing the same options directly to a unified() processor object. This site’s own astro.config.mjs hits the warning for exactly this reason: it sets markdown.rehypePlugins to add scope="col" to table headers and to style code block chrome, both real rehype plugins this site depends on.

npx astro build on this site's own astro@7.1.3
[astro] `markdown.remarkPlugins`, `markdown.rehypePlugins`, and `markdown.remarkRehype` are deprecated. Pass them to `unified({...})` from `@astrojs/markdown-remark` directly instead.

Scheduled for removal in Astro 8, not just deprecated

Astro’s 6.4 release notes list this as scheduled for removal in Astro 8.0. It still works fully on Astro 7, but treat the warning as a heads-up to migrate, not noise to ignore.

The fix: move plugins into unified()

@astrojs/markdown-remark exports a unified() processor factory built exactly for this. Its own type definitions document the replacement shape directly:

astro.config.mjs - before
// BROKEN, prints the deprecation warning on every build
markdown: {
  rehypePlugins: [rehypeTableHeaderScope, rehypeCodeBlockChrome],
},
astro.config.mjs - after
import { unified } from "@astrojs/markdown-remark";

// FIXED, same plugins, no warning
markdown: {
  processor: unified({
    rehypePlugins: [rehypeTableHeaderScope, rehypeCodeBlockChrome],
  }),
},

remarkPlugins and remarkRehype move the same way, as options on that same unified({...}) call.

Confirmed against a real build

Applying this exact change to this site’s own astro.config.mjs and running npx astro build removes the warning completely, with all 52 pages still building. The scope="col" attribute the rehypeTableHeaderScope plugin adds still shows up in the rendered output afterward, confirmed by grepping the built HTML for both posts that use a table. Nothing about the page output changed, only the warning disappeared.

This site hasn’t made the change permanent yet since the deprecated form still works cleanly on astro@7.1.3, but the fix above is the exact, tested change to make when migrating ahead of Astro 8.

See the Guides & Fixes archive for more fixes from this same upgrade.

Frequently asked

Does this deprecation warning break my build?

No. It's only a warning. The plugins configured under markdown.rehypePlugins keep running exactly as before, confirmed by building this site's own tables with and without the fix and comparing the rendered output. Nothing in the page output changes either way.

Will markdown.rehypePlugins stop working completely at some point?

Yes, eventually. Astro's own 6.4 release notes state that markdown.remarkPlugins, markdown.rehypePlugins, markdown.remarkRehype, markdown.gfm, and markdown.smartypants are deprecated and scheduled for removal in Astro 8.0. The warning still works today on Astro 7, but migrating now avoids a forced change later.

Emitted as FAQPage JSON-LD from the same frontmatter — one source, no duplicated prose.

Recent posts

Full-text search via Pagefind · ↑↓ to navigate · ↵ to open