A faithful Rust port of Mermaid JS — renders diagrams to SVG without a browser, Node.js, or any JavaScript runtime.
- 28 diagram types — all Mermaid built-ins
- Headless — pure Rust, no DOM, no JS runtime
- Fast — renders diagrams in microseconds
- Accurate — pixel-tested against Mermaid JS reference output (100-diagram visual regression suite)
- Themes — Default, Dark, Forest, Neutral
[dependencies]
ariel-rs = "0.4.0"use ariel_rs::{render, theme::Theme};
let svg = render("flowchart TD\n A --> B --> C", Theme::Default);
println!("{}", svg);| Type | Keyword(s) |
|---|---|
| Flowchart | flowchart / graph |
| Sequence | sequenceDiagram |
| Class | classDiagram / classDiagram-v2 |
| State | stateDiagram / stateDiagram-v2 |
| Entity Relationship | erDiagram |
| Gantt | gantt |
| Git | gitGraph |
| Pie | pie |
| Mindmap | mindmap |
| Timeline | timeline |
| Quadrant | quadrantChart |
| XY Chart | xychart-beta / xychart |
| C4 | C4Context / C4Container / C4Component / C4Dynamic / C4Deployment |
| Block | block-beta / block |
| Packet | packet-beta / packet |
| Journey | journey |
| Requirement | requirementDiagram / requirement |
| Kanban | kanban |
| Sankey | sankey-beta / sankey |
| Treemap | treemap-beta / treemap |
| Radar | radar-beta / radar |
| Venn | venn-beta / vennDiagram / venn |
| Architecture | architecture-beta / architecture |
| Event Modeling | eventmodeling / event-modeling |
| Info | info |
| Ishikawa | fishbone / ishikawa |
| Wardley | wardley |
| TreeView | treeView-beta / treeView |
If the input is invalid or the diagram type is unrecognised, render() returns a styled error SVG matching Mermaid's browser error format — it never panics.
use ariel_rs::{render, theme::Theme};
let svg = render(source, Theme::Dark);Available themes: Theme::Default, Theme::Dark, Theme::Forest, Theme::Neutral.
cargo testcargo install cargo-tarpaulin
cargo tarpaulin --out StdoutRequires Node.js.
cd visual-regression
npm install # first time only
cargo run --bin render_corpus --release # generate Rust SVGs for all themes
node run_regression_all.mjs # PNG conversion + compare + HTML reportariel-rs uses dagre-dgl-rs for directed graph layout (flowcharts, class diagrams, state diagrams, ER diagrams) and implements all other diagram types from scratch.
| Crate | Purpose |
|---|---|
dagre-dgl-rs |
Directed graph layout |
ab_glyph |
Font metrics for text measurement |
indexmap |
Deterministic map iteration |
serde_json |
JSON parsing (corpus loader) |
chrono |
Date handling for gantt diagrams |
MIT © 2026 Rochanglien Infimate
