Merman
A headless Rust implementation of Mermaid for parsing, layout, and rendering.
Quick start · Rendered output · Ecosystem · Compatibility · Documentation
Merman turns Mermaid source into diagrams without starting Node.js, Puppeteer, Chromium, or another JavaScript runtime in the native rendering path. Embed it in a Rust application, render from the command line, or use the browser and native bindings.
- Browserless rendering. Generate SVG in native applications, CI jobs, and documentation builds.
- Mermaid compatibility. Parsing, layout, configuration, theming, and SVG structure are checked against pinned upstream source and fixtures.
- Selectable capabilities. Use typed models and SVG by default; add diagnostics, editor support, PNG, JPEG, PDF, or ASCII/Unicode for supported diagram families.
Used by Zed. Zed uses Merman as its Rust Mermaid backend. Read the merged integration.
Rendered output
| Architecture | Mindmap | Sankey |
|---|---|---|
These diagrams were rendered headlessly by merman-cli using the same Rust engine.
Try the Playground for more examples; its hosted build follows its deployed package version.
Quick start
With Rust 1.95 or later, add Merman to your Cargo.toml:
[]
= "0.9.0"
Render a source string to SVG:
use ;
From a source checkout, run the same maintained example:
Default Rust features include all built-in diagram families, SVG, Cytoscape and ELK layouts, and math labels. Other outputs and analysis/editor APIs are opt-in. See the capability guide for smaller builds, including how to omit ELK, and the Rust examples for renderer reuse, cancellation, and host integration.
For command-line use, follow the CLI installation guide, then render a Mermaid file:
Ecosystem
| Your task | Start here |
|---|---|
| Embed parsing, layout, and rendering in Rust | merman API documentation and Rust embedding guide |
| Render files, export images, process Markdown, or lint from the shell | merman-cli |
| Render or analyze in a browser or Worker | Browser packages |
| Render from native Node.js | Node.js package (experimental) |
| Add incremental syntax trees, highlighting, or folding | tree-sitter-mermaid (independently versioned) |
| Add diagnostics, completion, navigation, or rename | merman-lsp or VS Code extension |
| Add Mermaid diagrams to Rustdoc | CLI fragments or merman-rustdoc |
| Integrate C/C++, Python, Flutter, Android, Apple, or Typst | Package surface guide |
Use the documentation index for task-specific guides, the release and upgrade index when upgrading, and the Changelog for user-facing changes. Each package channel publishes separately; check its guide for available versions and capabilities.
Compatibility
For the 0.8.0 to 0.9.0 API and output changes, use the upgrade guide. CLI text measurement remains deterministic by default; explicit font files or directories opt into actual-font layout.
Merman follows Mermaid 12.1.0, with source-backed checks for semantic models, layout, and SVG
structure. See the alignment dashboard for diagram coverage and documented differences.
Text measurement, browser font fallback, HTML labels, foreignObject, and hand-drawn paths can
produce differences from browser output. Pixel-identical Chromium rendering is not guaranteed.
For consumers that cannot display HTML labels, choose the resvg-safe SVG pipeline or a typed
PNG, JPEG, or PDF target; see the SVG output pipeline and rendering security guide.
Development
See the contributor and CI guide for local checks and the documentation index for architecture, parity evidence, and release procedures.
License and attribution
Merman's own code is available under the Apache License 2.0 or MIT License. Distributed third-party components have their own notices: default Rust rendering features include EPL-2.0 ELK, and math may include OFL-1.1 font data. See THIRD_PARTY_NOTICES.md for attribution and the feature-dependent notice requirements.
Merman is independent of, and not affiliated with, endorsed by, or sponsored by the Mermaid project or its maintainers.