Remark and rehype plugins, ported to Sätteri
Remark and rehype plugins ported to Sätteri, the Rust Markdown engine behind Astro 7. Ten plugins, each checked against the output of the original.
npm install <plugin>Install the plugins you need one at a time. Each plugin's page shows its own install command and usage.
All plugins
- satteri-slugreplaces
rehype-slug· HTML (HAST)npm install satteri-slugAdds an id to every heading, using the same GitHub slugging rules.
- satteri-autolink-headingsreplaces
rehype-autolink-headings· HTML (HAST)npm install satteri-autolink-headingsAdds an anchor link to every heading, so sections can be linked to.
- satteri-katexreplaces
rehype-katex· Markdown (MDAST)npm install satteri-katexRenders math with KaTeX, at build time, with no client-side script.
- satteri-mathjaxreplaces
rehype-mathjax· Markdown (MDAST)npm install satteri-mathjaxRenders math with MathJax, for when you need its output format.
- satteri-breaksreplaces
remark-breaks· Markdown (MDAST)npm install satteri-breaksTurns single newlines into line breaks, like chat and comment apps do.
- satteri-githubreplaces
remark-github· Markdown (MDAST)npm install satteri-githubAutolinks issues, pull requests, mentions and commit SHAs to GitHub.
- satteri-sanitizereplaces
rehype-sanitize· HTML (HAST)npm install satteri-sanitizeStrips unsafe HTML, attributes and URLs from untrusted Markdown.
- satteri-mdx-frontmatterreplaces
remark-mdx-frontmatter· Markdown (MDAST)npm install satteri-mdx-frontmatterExposes a page's frontmatter as named MDX exports.
- satteri-validate-linksreplaces
remark-validate-links· Markdown (MDAST)npm install satteri-validate-linksReports links to missing files and headings at build time.
- satteri-citationreplaces
rehype-citation· Markdown (MDAST)npm install satteri-citationRenders Pandoc-style citations and a reference list from BibTeX or CSL-JSON.
Use with Astro
Pass the plugins to Astro's Sätteri processor. Each plugin is a function you call with its options.
// astro.config.mjs
import { satteri } from "@astrojs/markdown-satteri";
import { satteriSlug } from "satteri-slug";
import { satteriCitation } from "satteri-citation";
export default defineConfig({
markdown: {
processor: satteri({
mdastPlugins: [
satteriCitation({ bibliography: "./src/refs.bib" }),
],
hastPlugins: [satteriSlug()],
}),
},
});Some plugins run on the Markdown tree (MDAST) and others on the HTML tree (HAST). Each plugin page says which, because the order of plugins in each list matters.
Why these exist
Astro 7 compiles Markdown with Sätteri, which does not run remark or rehype plugins. These packages restore the behaviour of the originals, with the same output checked against them, so existing sites keep working.
Read the demo to see every plugin running in a real Astro build, or the MDX page for the MDX side. The source, tests and changelogs are on GitHub.