| Crates.io | mermaid-rs-renderer |
| lib.rs | mermaid-rs-renderer |
| version | 0.1.0 |
| created_at | 2026-01-23 04:14:36.780792+00 |
| updated_at | 2026-01-23 04:14:36.780792+00 |
| description | Fast Mermaid renderer in Rust (flowchart/class/state/sequence) |
| homepage | https://github.com/1jehuang/mermaid-rs-renderer |
| repository | https://github.com/1jehuang/mermaid-rs-renderer |
| max_upload_size | |
| id | 2063377 |
| size | 367,527 |
A fast Mermaid renderer in Rust (flowchart + basic class/state/sequence).
flowchart / graph with TD/TB/LR/BT/RL and subgraph directionclassDiagram (class blocks + relations)stateDiagram-v2 (states, aliases, transitions, start/end)sequenceDiagram (participants, messages, lifelines; no activation or notes yet)classDef, class, inline :::class, style (nodes + subgraphs), linkStyle (fill/stroke/text/stroke-width/dasharray + label color)subgraph ... end)%%{init}%% (themeVariables subset, JSON5-style allowed)# Render SVG to stdout
cat diagram.mmd | mmdr -e svg
# Render a Markdown file (all mermaid blocks)
# If output is a directory, renders diagram-1.svg, diagram-2.svg, ...
mmdr -i README.md -o /tmp/diagrams -e svg
# Render to PNG
mmdr -i diagram.mmd -o diagram.png -e png
# Use config file (Mermaid-like themeVariables)
mmdr -i diagram.mmd -o diagram.svg -e svg -c config.json
# Override spacing via CLI
mmdr -i diagram.mmd -o diagram.svg -e svg --nodeSpacing 60 --rankSpacing 120
# From source
cargo install --path .
# From crates.io (once published)
cargo install mermaid-rs-renderer
Homebrew (macOS/Linux):
brew tap 1jehuang/mmdr
brew install mmdr
Scoop (Windows):
scoop bucket add mmdr https://github.com/1jehuang/scoop-mmdr
scoop install mmdr
AUR (Arch):
# Pending publication; PKGBUILD lives at https://github.com/1jehuang/aur-mmdr
# Once published, install via:
yay -S mmdr-bin
We accept a subset of Mermaid themeVariables in a JSON config file. Example:
{
"themeVariables": {
"primaryColor": "#F8FAFF",
"primaryTextColor": "#1C2430",
"primaryBorderColor": "#C7D2E5",
"lineColor": "#7A8AA6",
"secondaryColor": "#F0F4FF",
"tertiaryColor": "#E8EEFF",
"edgeLabelBackground": "#FFFFFF",
"clusterBkg": "#F8FAFF",
"clusterBorder": "#C7D2E5",
"background": "#FFFFFF",
"fontFamily": "Inter, Segoe UI, system-ui",
"fontSize": 13
},
"flowchart": {
"nodeSpacing": 40,
"rankSpacing": 80
}
}
cargo test
cargo run -- -i docs/diagrams/architecture.mmd -o /tmp/arch.svg -e svg
We include two benchmark layers:
cargo bench --bench renderer
cargo build --release
scripts/bench_compare.py
You can tweak runs with RUNS/WARMUP, or skip mermaid-cli with SKIP_MERMAID_CLI=1.
Machine: Intel(R) Core(TM) Ultra 7 256V (8 cores), Linux 6.18.2-arch2-1
Node: v25.2.1, mermaid-cli: 11.12.0
Runs: 2 warmup + 8 measured, SVG output
| Case | mmdr mean (ms) | mermaid-cli mean (ms) | Speedup |
|---|---|---|---|
| flowchart_small | 2.85 | 2783.71 | ~976× |
| flowchart_medium | 3.09 | 2962.13 | ~960× |
| flowchart_large | 6.42 | 3342.53 | ~521× |
Notes:
mermaid-cli includes Chromium startup (via Puppeteer), so it has a large fixed cost.MIT