Expand description
kymostudio core — pure-Rust SVG rasterization (PNG) and vector PDF, built on
resvg / svg2pdf.
No browser, no headless Chrome, no C dependencies. This mirrors what the
Python package does via resvg-py (to_webp.py) so SVG→PNG output stays
consistent across implementations — resvg is CSS-class-aware, which is why
the project avoids cairosvg. PDF goes through svg2pdf (same usvg lineage),
keeping vector output CSS-class-aware too.
Modules§
- d2
- D2 → kymo importer (front-end) — the inverse of
crate::flowchart::emit::to_d2. - dot
- Graphviz DOT → kymo importer — the inverse of
crate::flowchart::emit::to_dot. - drawio
- draw.io (mxGraph XML) encoder: a resolved
Diagram→ a.drawiodocument. - flowchart
- Format-neutral flowchart IR — a positionless node/edge/subgraph model.
- flowchart_
svg - Pure-Rust flowchart SVG renderer: a resolved
Diagram→ an SVG string. - kymojson
.kymo.jsonserializer — aDiagram→ the kymo.json interchange string.- layout
- Layered (Sugiyama) layout for Mermaid flowcharts → a resolved
Diagram. - math
- Minimal TeX-math → Unicode for Mermaid
$…$/$$…$$labels. This is not a full KaTeX: it maps common commands (Greek letters, operators, relations, arrows, set theory) to Unicode and flattens\frac/\sqrt/\text, so a rasterised PNG/PDF shows readable math instead of raw LaTeX. Unknown commands fall back to their bare name. Text with no matched$pair is unchanged. - mermaid
- Mermaid → kymo importer (front-end).
- model
- The kymo diagram data model — a Rust mirror of
packages/python/src/kymo/model.py. - sequence
- Sequence-diagram IR — the sibling of
crate::flowchartfor the MermaidsequenceDiagramfamily.
Enums§
- Render
Error - Something went wrong turning SVG bytes into PNG or PDF bytes.
Functions§
- d2_
to_ kymojson - Import D2 flowchart source → the resolved
.kymo.jsonmodel (D2 as a kymo source format — the inverse ofmermaid_to_d2). - d2_
to_ svg - Render D2 flowchart source → SVG, fully in Rust: parse D2 → flowchart IR →
layout_flowchart→ theflowchart_svgrenderer. No externald2binary. - dot_
to_ kymojson - Import Graphviz DOT flowchart source → the resolved
.kymo.jsonmodel. - dot_
to_ svg - Render Graphviz DOT flowchart source → SVG, fully in Rust: parse DOT →
flowchart IR →
layout_flowchart→ theflowchart_svgrenderer. No externaldotbinary. - mermaid_
state_ to_ svg - Render a Mermaid state diagram → SVG via the flowchart layout + renderer.
- mermaid_
to_ d2 - Convert Mermaid flowchart source to another text DSL via the flowchart IR.
- mermaid_
to_ dot - Convert Mermaid flowchart source to Graphviz DOT (via the flowchart IR).
- mermaid_
to_ drawio - Convert Mermaid flowchart source → draw.io (mxGraph XML).
- mermaid_
to_ gaphor - Convert a Mermaid
sequenceDiagramto a Gaphor native.gaphorfile (XML v3.0) carrying a laid-out sequence diagram. - mermaid_
to_ kymojson - Parse Mermaid source (flowchart) into the
.kymo.jsoninterchange string. - mermaid_
to_ mdj - Convert a Mermaid
sequenceDiagramto a StarUML native.mdj(metadata- JSON) carrying a laid-out sequence diagram. - mermaid_
to_ mermaid - Round-trip / normalize Mermaid flowchart source through the IR.
- mermaid_
to_ sequence_ svg - Render a Mermaid
sequenceDiagramto SVG (kymo own renderer: real<text>, so PNG/PDF keep their labels). Notes/activations not yet drawn. - mermaid_
to_ svg - Render Mermaid flowchart source → SVG (parse → layout → the pure-Rust
flowchart_svgrenderer). The Rust core’s own flowchart SVG (its own look, not byte-identical to the Python/JS renderers). - mermaid_
to_ xmi - Convert a Mermaid
sequenceDiagramto OMG XMI 2.5.1 (a UML 2.5.1Interaction— lifelines, messages, activations, combined fragments, notes). - register_
font - Register a font (TTF/OTF bytes) for
<text>rendering insvg_to_png/svg_to_pdf. Cumulative; intended for wasm/Workers where no system fonts exist. On native builds system fonts still load — registered fonts take over only the generic families. - svg_
to_ pdf - Convert SVG bytes to a vector PDF (one page, intrinsic SVG size, 72 dpi).
- svg_
to_ png - Render SVG bytes to PNG bytes at the given
scale(1.0 = intrinsic size).