Astro 6.4

By
Erika

Astro 6.4 is here! On today’s menu: a pluggable Markdown pipeline, a new Rust-based Markdown processor for you to try, and helpers to facilitate the use of experimental advanced routing with Cloudflare.

Explore what’s new in this release:

To upgrade an existing project, use the automated @astrojs/upgrade CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:

# Recommended:
npx @astrojs/upgrade
# Manual:
npm install astro@latest
pnpm upgrade astro --latest
yarn upgrade astro --latest

New markdown.processor API

Astro’s Markdown pipeline has always been built around unified (remark, rehype, and friends). That ecosystem is powerful, having thousands of plugins available, but perhaps it’s not up to your taste. Astro 6.4 adds a new markdown.processor configuration option that lets you swap that pipeline out entirely.

The default processor is still unified(), so existing projects keep working without any changes. Your remark and rehype plugins continue to behave the same, but they are now configured directly on the processor, instead of in the top-level markdown config:

astro.config.mjs
import { defineConfig } from 'astro/config';
import { unified } from '@astrojs/markdown-remark';
import remarkToc from 'remark-toc';
export default defineConfig({
markdown: {
processor: unified({
remarkPlugins: [remarkToc],
}),
},
});

The existing top-level markdown.remarkPlugins, markdown.rehypePlugins, markdown.remarkRehype, markdown.gfm, and markdown.smartypants options still work, but they’re now deprecated in favor of passing them to unified({...}), and will be removed in Astro 8.0.

For more information, see the updated Markdown guide.

Faster Markdown builds with Sätteri

A pluggable processor API also means Astro can ship other Markdown processors. Astro 6.4 introduces a new @astrojs/markdown-satteri package, with a new processor based on Sätteri, a Markdown and MDX pipeline written in Rust.

Sätteri is much faster than the default unified-based pipeline, and it implements many Markdown features natively that previously required plugins. In our own testing, switching the Astro and Cloudflare docs site to Sätteri shaved over a minute off their respective build time. To try it out, install the package and set it as your processor:

npm install @astrojs/markdown-satteri
astro.config.mjs
import { defineConfig } from 'astro/config';
import { satteri } from '@astrojs/markdown-satteri';
export default defineConfig({
markdown: {
processor: satteri({
features: { directive: true },
}),
},
});

Sätteri doesn’t run remark or rehype plugins. If you depend on plugins from the unified ecosystem, you’ll need to either stay on unified() for now or port them to Sätteri MDAST or HAST plugins.

We hope to make Sätteri the default Markdown processor in a future major version of Astro. To give feedback on the Rust processor and the new API, see the Native Markdown / MDX RFC.

Cloudflare helpers for advanced routing

If you’re using experimental advanced routing (added in Astro 6.3) on Cloudflare, @astrojs/cloudflare now ships a cf() helper that wires up the Cloudflare-specific bits for you: SESSION KV binding injection, static asset serving via the ASSETS binding, locals.cfContext, client address from cf-connecting-ip, waitUntil, and prerendered error pages.

With a custom fetch handler, use cf() from @astrojs/cloudflare/fetch:

src/app.ts
import { astro, FetchState } from 'astro/fetch';
import { cf } from '@astrojs/cloudflare/fetch';
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
const state = new FetchState(request);
const asset = await cf(state, env, ctx);
if (asset) return asset;
return astro(state);
},
};

With Hono, use cf() from @astrojs/cloudflare/hono as middleware.

src/app.ts
import { Hono } from 'hono';
import { actions, middleware, pages, i18n } from 'astro/hono';
import { cf } from '@astrojs/cloudflare/hono';
const app = new Hono<{ Bindings: Env }>();
app.use(cf());
app.use(actions());
app.use(middleware());
app.use(pages());
app.use(i18n());
export default app;

Other improvements

For a complete list of bug fixes and smaller improvements, see the full changelog.

Community

The Astro core team is:

Alexander Niebuhr , Armand Philippot , Chris Swithinbank , Emanuele Stoppa , Erika , Florian Lefebvre , Fred Schott , HiDeoo , Luiz Ferraz , Matt Kane , Matthew Phillips , Reuben Tier , Sarah Rainsberger , and Yan Thomas .

Thanks to all the other contributors who helped make Astro 6.4 possible with code and docs additions and improvements, including:

Alexander Flodin, Alexis Aguilar, Arnas Donauskas, Barry, David Large, divyeshb13, Dor Alagem, Eli Kent [SSW], Eric Mika, Felipe Arce, Felix Schneider, fkatsuhiro, Great Journey, Harsh Agarwal, helio-cf, Henri Koskenranta, Igor Koop, Jon Ege Ronnenberg, Joost de Valk, Jordan Demaison, Junseong Park, knj, LongYC, Louis Escher, Matt Wicks [SSW], Mochammad Farros Fatchur Roji, oab24413gmai, ocavue, Quetzal Rivera, Rafael Yasuhide Sudo, randomguy-2650, Sakku 🦉, Shinya Fujino, Tarik, Thomas Bonnet, Vincent 🌿, vrabe, WavyCat, Zubair Ibn Zamir, and