An mdbook preprocessor that renders Mermaid diagrams to inline SVG at build time.
- Inline SVG — diagrams are rendered during build, no JavaScript required at runtime
- 5 mdbook themes — generates a variant for each theme (Light, Navy, Coal, Ayu, Rust) with automatic switching via CSS
- Pure Rust — uses mermaid-rs-renderer for rendering
cargo install mdbook-mermaidAdd the preprocessor to your book.toml:
[preprocessor.mermaid]
command = "mdbook-mermaid"Write Mermaid diagrams in fenced code blocks:
```mermaid
graph LR
A[Start] --> B[End]
```The preprocessor replaces each block with inline SVG wrapped in theme-specific <div> elements. The correct variant is shown automatically based on the active mdbook theme.