Skip to main content

Crate rusty_mermaid

Crate rusty_mermaid 

Source
Expand description

§rusty-mermaid

Mermaid diagram rendering in pure Rust.

The base crate parses mermaid syntax and produces a Scene — a backend-agnostic intermediate representation of primitives (rects, paths, text, etc.).

Enable features to add rendering backends:

FeatureWhat you get
svgto_svg() → SVG string
rasterto_png() → PNG bytes
wgpuvello/WebGPU scene builder
gpuigpui canvas element (Zed)
viewportPan/zoom state + coordinate transforms

Structs§

BBox
Axis-aligned bounding box. x and y are the center coordinates (matching dagre’s convention).
Color
RGBA color.
ParseError
A parse error with location information.
Point
2D point in layout coordinate space.
Scene
Backend-agnostic drawing output. The contract between layout and rendering.
Style
Visual style for shapes and paths.
TextStyle
Text styling properties.
Theme
Diagram color theme. All rendering reads from this — no hardcoded values.

Enums§

DiagramKind
Supported diagram types.
Direction
Layout direction for ranked graphs.
Primitive
A single drawing element. All backends (SVG, raster, gpui, wgpu, PDF) consume these.
TextAnchor
Text horizontal alignment.

Functions§

detect
Detect the diagram type from the first non-empty, non-comment line.
render
Parse and render a mermaid diagram to a Scene.
render_to_scene
Unified entry: parse + layout → Scene.