Skip to main content

Crate kymostudio_core

Crate kymostudio_core 

Source
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 .drawio document.
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.json serializer — a Diagram → 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::flowchart for the Mermaid sequenceDiagram family.

Enums§

RenderError
Something went wrong turning SVG bytes into PNG or PDF bytes.

Functions§

d2_to_kymojson
Import D2 flowchart source → the resolved .kymo.json model (D2 as a kymo source format — the inverse of mermaid_to_d2).
d2_to_svg
Render D2 flowchart source → SVG, fully in Rust: parse D2 → flowchart IR → layout_flowchart → the flowchart_svg renderer. No external d2 binary.
dot_to_kymojson
Import Graphviz DOT flowchart source → the resolved .kymo.json model.
dot_to_svg
Render Graphviz DOT flowchart source → SVG, fully in Rust: parse DOT → flowchart IR → layout_flowchart → the flowchart_svg renderer. No external dot binary.
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 sequenceDiagram to a Gaphor native .gaphor file (XML v3.0) carrying a laid-out sequence diagram.
mermaid_to_kymojson
Parse Mermaid source (flowchart) into the .kymo.json interchange string.
mermaid_to_mdj
Convert a Mermaid sequenceDiagram to 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 sequenceDiagram to 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_svg renderer). The Rust core’s own flowchart SVG (its own look, not byte-identical to the Python/JS renderers).
mermaid_to_xmi
Convert a Mermaid sequenceDiagram to OMG XMI 2.5.1 (a UML 2.5.1 Interaction — lifelines, messages, activations, combined fragments, notes).
register_font
Register a font (TTF/OTF bytes) for <text> rendering in svg_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).