Plugins
Extend the MDX pipeline with remark and rehype plugins.
Publier builds on Astro’s MDX pipeline, so any remark or rehype plugin from the ecosystem works. Publier registers the standard plugins automatically; you can add more in astro.config.ts.
Built-in plugins (auto-wired)
You do not need to register these manually:
| Plugin | What it does |
|---|---|
| Container directives | Parses :::note, :::tip, etc. |
| Asides | Converts directive nodes to <Aside> callout HTML |
| GitHub Flavored Markdown | Tables, strikethrough, task lists, autolinks |
| Heading anchors | Wraps headings with anchor links |
Opt-in plugins (enabled via integration options)
docsShell({ math: true, // KaTeX math rendering (install peer deps first) mermaid: true, // Mermaid diagrams (auto-detected; explicitly force-enable here) snippets: { directory: 'src/content/snippets' }, // reusable MDX fragments})Adding extra remark plugins
Add custom remark plugins alongside the Publier integration — they append after the built-ins:
import remarkSmartypants from 'remark-smartypants';import tailwind from '@tailwindcss/vite';import { defineConfig } from 'astro/config';import { docsShell } from '@publier/shell/integration';
export default defineConfig({ integrations: [docsShell()], markdown: { remarkPlugins: [ [remarkSmartypants, { dashes: 'oldschool' }], ], }, vite: { plugins: [tailwind()] },});Plugins in markdown.remarkPlugins run after Publier’s built-ins.
Adding rehype plugins
Same pattern — append to markdown.rehypePlugins:
import rehypeExternalLinks from 'rehype-external-links';
export default defineConfig({ // ... markdown: { rehypePlugins: [ [rehypeExternalLinks, { target: '_blank', rel: ['noopener', 'noreferrer'] }], ], },});Plugin execution order
- Publier’s built-in plugins (directive → callouts → GFM)
- User
markdown.remarkPlugins(appended by Astro after integrations) - Rehype plugins in the same order
If you need a plugin to run before Publier’s built-ins, email [email protected] — configurable plugin ordering is planned.