BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Astro Introduces Sätteri: A Rust-powered Markdown And Mdx Processor With Up To 60% Faster Builds

Astro Introduces Sätteri: A Rust-powered Markdown And Mdx Processor With Up To 60% Faster Builds

Listen to this article -  0:00

Sätteri, a new high-performance Markdown and MDX processor for the JavaScript ecosystem, has been introduced by the Astro team and now sits at the heart of the recently released Astro 7.0. Built in Rust and maintained separately by Astro core contributor Erika under the Bruits collective, Sätteri lives outside the Astro organisation but has become a core dependency of the framework, where the team says it contributes up to 60% faster builds.

Sätteri puts flexible JavaScript plugins on top of a fast Rust Markdown and MDX engine, using pulldown-cmark for CommonMark parsing and Oxc for MDX expression parsing. It ships platform-specific native binaries with a WASM fallback, the same approach Astro uses for its new Rust compiler, and it can be tried live in the browser via WebAssembly.

The processor first appeared as an opt-in @astrojs/markdown-satteri package in Astro 6.4, and Astro 7 promotes it to the default. The headline benefit is speed: switching the Astro and Cloudflare documentation sites to Sätteri shaved over a minute off each build, and overall Astro 7 builds improved by 15 to 61%. Much of that gain comes from moving parsing out of JavaScript, replacing the unified pipeline of remark, rehype and a long tail of dependencies that previously ran plugin after plugin over the full syntax tree.

Speed is not the only change. Sätteri implements natively many features that previously required separate plugins, including GitHub Flavored Markdown, smart punctuation, container directives, math, frontmatter, superscript, subscript and wikilinks. Optional features are enabled through the processor config.

On Hacker News, one developer expressed their disappointment:

Switch from widely supported unified/rehype to own rehype-incompatible markdown tooling just for build time speed improvement is quite upsetting

Good that they added a tool to keep using rehype, but I’m unsure that it will last

Which prompted a reply from Erika, the author of the library:

We don't intend on removing support for the unified ecosystem, we on purpose made the Markdown processing pipeline pluggable so that it was possible for both to exists!
The vast majority of our users don't use any sort of unified plugins, so a pipeline that's faster (and about 100 deps leaner) felt like a better default.

Another commenter asked:

How does Satteri compare to a standard library like marked (https://github.com/markedjs/marked)?

To which Erika also replied:

It depends in what regards you mean, I have some benchmarks here if you'd like to take a look at those:

https://github.com/Princesseuh/web-markdown-benchmark

The TL;DR is that marked is very light, but a bit on the slower side compared to Sätteri and markdown-it (and its forks). I'm not sure how friendly the extensibility is, but Sätteri re-use the same AST format as the unified ecosystem, which might feel more friendly.

Both good options, though!

The main migration caveat is that Sätteri does not run remark or rehype plugins. The Astro v7 upgrade guide advises that projects without plugins need no changes, while those depending on plugins can port them to Sätteri MDAST or HAST plugins or stay on unified by installing @astrojs/markdown-remark. Upgrades are handled with npx @astrojs/upgrade.

Sätteri is not alone in chasing native Markdown speed. Bun.markdown, written in Zig, has reported comparable gains but lacks a plugin system, leaving Sätteri's reuse of the unified AST format as a distinguishing feature. Sätteri is open source and available via npm and crates.io.

About the Author

Rate this Article

Adoption
Style

BT