Skip to content
Ferrigura

Ferrigura / Reference

Project overview

crates.io docs.rs CI License

ferrigura renders Mermaid diagram text to SVG in Rust, without a browser. It is a port of Mermaid 12.2.0 with all 33 of its diagram types: the same diagram text gives the same diagram, and the geometry of the output is checked against Mermaid run in Chromium.

flowchart LR
  text[Diagram text] --> parse[Parser] --> layout[Layout: ELK, swimlane, cose-bilkent, fcose, venn] --> svg[SVG]

Website and getting started · Diagram reference

Using ferrigura

crates/ferrigura/README.md describes the library, crates/ferrigura-cli/README.md the command-line tool, and crates/ferrigura-node/README.md the Node.js addon. The library and the command-line tool are on crates.io as ferrigura and ferrigura-cli; the standalone npm distribution is prepared in node/ and awaits registry bootstrap.

cargo add ferrigura
cargo install ferrigura-cli

Alternatives

Other projects render Mermaid's syntax too. Which one fits depends on where the diagrams are drawn and how close to Mermaid they must look; the comparison sets them side by side, with measured sizes and render times.

ProjectA fit when
MermaidDiagrams are drawn in a browser, with click callbacks, tooltips and the newest diagram types first. On a server it needs a headless browser (mermaid-cli).
PeleSpeed matters most, in any JavaScript runtime, and a layout and style of its own are fine.
mermanMermaid's drawing is wanted in Rust with output beyond SVG (PNG, PDF, ASCII) or bindings such as WebAssembly and Python, measured without bundled fonts.
mermaid-rs-rendererA small, fast Rust renderer with a layout of its own is enough, for 23 of the diagram types.
ferriguraMermaid 12.2.0's drawing is wanted without a browser and the same on every machine, with its fonts embedded: in Rust, on the command line or in Node.

Documentation

PageFor
docs/ARCHITECTURE.mdHow a diagram becomes SVG, the crates, and what ferrigura does not do
docs/decisions/The decisions that shape ferrigura, each with its scope and reasons
docs/diagrams/Each diagram type: what is covered, how it is laid out, and its known gaps
docs/LEARNINGS.mdWhat porting taught: browser arithmetic, text metrics and the quirks of the layout engines
docs/DEVELOPING.mdSetup, the checks, and how a change is checked against Mermaid
docs/comparisons/ferrigura next to Mermaid and other renderers, with measured sizes and render times

Contributing

ferrigura is checked against upstream Mermaid at a pinned commit: every parser change against Mermaid's parser on every input, every renderer change against Mermaid's geometry in Chromium. docs/DEVELOPING.md has the setup and the commands, and AGENTS.md the rules every change follows. Commit messages follow Conventional Commits; releases are made from them.

License and credits

MIT, see LICENSE. Some crates port code or bundle fonts under the licenses of their sources, which their NOTICE.md files list; ferrigura-elk is under EPL-2.0. ferrigura is a port of Mermaid, which was created by Knut Sveidqvist and is maintained by the Mermaid contributors; its license and copyright notice stay with the port.