Releases: 2389-research/MermaidKit
Release list
v2.2.0 — Any source format, inline and narrated
Format-aware entry points, so a rich-text host (a live editor, a document view)
gets the same sized, themed NSAttributedString attachment and accessibility
narration for every supported source format — not just Mermaid — without ever
touching the parsers.
- Format-aware
MermaidRendererAPI. A newDiagramSourceFormat
(.mermaid,.dot,.dippin,.sqlDDL,.gitLog) drives
diagram(source:format:)and format-awareimage/pngData/
attachmentString/altText(source:format:), plus diagram-based twins.
DOT, Dippin, SQL DDL and git-log sources now render inline and narrate exactly
like Mermaid. (#46, #47) - Non-Mermaid formats ride the same NSCache path as Mermaid — keyed by
format tag + source so same-text DOT and Mermaid can't collide — so a live
editor doesn't re-parse and re-render on every keystroke.
Fixed
- Arrowheads over tinted group boxes (C4, architecture, block) no longer show
a pale canvas-colored wedge. The head is now a single opaque triangle
rather than a translucent head painted over a canvas-colored shaft-eraser —
which removes both the seam the eraser prevented and the wedge it caused. Both
render paths (CoreGraphics + the platform-freeRenderScene) change in lockstep
so the draw-vs-scene conformance ratchet still holds. (#23)
Docs
- The architecture/pipeline diagrams in the platform notes and package READMEs
are now Mermaid (```mermaid— rendered natively by GitHub, and by
MermaidKit itself), replacing the ASCII-art code fences. MermaidKit now
dogfoods its own renderer in its docs. (#49)
Full changelog: https://github.com/2389-research/MermaidKit/blob/main/CHANGELOG.md
v2.1.0 — Flutter, and any bare surface
A sixth native platform — Flutter — and the raw-raster primitive that drives any bare surface: a Raspberry Pi framebuffer, an SDL2 window, a GPU texture. Additive; existing platforms and output are unchanged.
Flutter
flutter/mermaidkit renders all 30 types with a Dart CustomPainter on Flutter's Skia/Impeller canvas — a fidelity match for Android, and one plugin reaches iOS, Android, web, and desktop.
final scene = MermaidNative.scene("flowchart LR\n A[Start] --> B[End]"); // dart:ffi → Swift core
CustomPaint(painter: MermaidPainter(scene!));- A
SceneWireDart model (sealed classes + atypediscriminator) +MermaidPainter/MermaidDiagram. - A
dart:ffibridge (MermaidNative) overmmk_scene_jsonin the Swift core built as a shared library — the Flutter analogue of Android's JNI and .NET's P/Invoke, calling the@_cdeclC ABI directly. - Optional
fontFamilyfor bundled/custom label fonts.
Any bare surface
MermaidRenderer.rgbaRaster — previously Apple-only — now returns raw RGBA on Linux too (reading the Cairo/Silica image surface directly). This is the primitive every display-server-free surface needs.
tools/pi-canvas is an infinite, pannable canvas of diagrams composited into a 640×480 framebuffer, with a single Framebuffer seam and three backends — a PNG stand-in, /dev/fb0 (RGB565), and SDL2 — verified on the Pi's aarch64 architecture.
Full detail in CHANGELOG.md; platform notes under flutter/ and tools/pi-canvas.
v2.0.0 — Native everywhere
MermaidKit now renders natively on five platforms — macOS/iOS, Linux, Android, Windows/.NET, and WebAssembly — from one Swift layout core. The Swift package's public API is additive (no breaking changes); the major bump marks the platform expansion. Android, Windows, and .NET ship as their own 0.1.0 artifacts.
Native everywhere
-
Android — the
android/Gradle module renders all 30 types with a KotlinCanvas. ASceneWiremodel +SceneRenderer, a JNI bridge (MermaidNativeover a per-ABIlibmermaidkit.so), the device measure seam (Paint.measureTextthrough JNI), Material theming (MermaidTheme.fromMaterial), a ComposeMermaidDiagram+ classicMermaidView,contentDescriptionfrom the narration, and a stripped multi-ABI AAR — verified on an android-34 emulator in CI.MermaidDiagram("flowchart LR\n A[Start] --> B[End]", Modifier.fillMaxWidth())
-
Windows / .NET — the
windows/library renders with SkiaSharp (real Skia, a fidelity match for Android; no SVG fallback): aSceneWiremodel, aSceneRendereroverSKCanvas, and a P/Invoke bridge (MermaidNativeover a Swift-builtMermaidKitCShared.dll). Gated onwindows-latest.var scene = MermaidNative.Scene("flowchart LR\n A[Start] --> B[End]"); new SceneRenderer().Draw(scene, canvas);
-
WebAssembly — the platform-free core compiles to
wasm32-unknown-wasiand emits SVG (or a Canvas2D scene) in the browser.
Proven byte-identical
A conformance harness + CI gate run the same fixtures through the core on all five platforms and assert one signature. Reaching byte-identity caught and fixed two real cross-platform determinism bugs — a Double→JSON formatting difference between Foundation implementations (fixed via 1/256-grid coordinate quantization), and a ceil that amplified a 1-ULP sin/cos difference in pie tessellation.
C ABI additions
mmk_scene_json_themed + ThemeWire (theme a scene with caller colors); a dynamic MermaidKitCShared product (the Windows DLL); WASI/Bionic portability guards.
Full detail in CHANGELOG.md and the platform notes under docs/notes/.
v1.4.0 — SVG export, RenderScene IR, git-log front-end
A platform-free render IR with SVG output, and a fifth input front-end. All additive — existing diagram rendering is unchanged.
SVG export
MermaidRenderer.svg(source:theme:) renders any of the 30 diagram types to a standalone SVG document — with no CoreGraphics. It goes through a new public, platform-free render IR:
RenderScene(MermaidLayout) — aCodabledisplay list that fully determines the picture (shaped nodes, arrowed/dashed edges, text, containers), lowered from every diagram type;SVGRenderer.svg(_:)paints it. This is the foundation for a planned native Android renderer and a plugin/interchange contract (docs/notes/android.md).- Cross-process determinism is CI-gated for the RenderScene/SVG pipeline as well as the raster path.
New front-end: git log → gitgraph
GitLogParser.parse(_:) turns git log output into the GitGraph IR — a fifth input front-end after Mermaid, DOT, Dippin, and SQL. Two-pass topological ordering, branch-lane derivation from ref decorations, --format gitlog in mermaidkit-term.
Full notes in CHANGELOG.md.
🤖 Generated with Claude Code
v1.3.0 — DOT export, SQL → ER, diagram narration
Three new capabilities on the front/back-end seam. All additive — the rendered output of existing diagrams is unchanged.
DOT export
DOTExporter.export(_:) emits a Flowchart as Graphviz DOT — the inverse of the DOT front-end, so MermaidKit is now a Mermaid ⇄ DOT converter. Flat charts round-trip exactly; clustered charts round-trip structurally.
SQL DDL → ER front-end
SQLDDLParser.parse(_:) turns a CREATE TABLE schema dump into an ER diagram: typed columns, PRIMARY/FOREIGN/UNIQUE keys (inline and table-level), and REFERENCES → one-to-many crow's-foot relationships. Handles dialect quoting and comments; degrades to nil on malformed input.
- New:
ERDiagram.Attribute.keysrendersPK/FK/UKbadges (no-op when empty, so existingerDiagramoutput is unchanged).
Diagram narration
MermaidAltText.narrate(_:) — a step-by-step accessibility walkthrough (richer than describe's summary): follows a flowchart through its decisions, reads a state machine from its initial state, spells out ER cardinalities, replays a sequence message by message. Every other type falls back to describe. Deterministic and length-bounded.
Full notes in CHANGELOG.md.
🤖 Generated with Claude Code
v1.2.0 — DOT + Dippin front-ends, terminal renderer, layout pass
Two new front-ends, a terminal renderer, and an edge-label/back-edge layout pass. Additive to the public API; the layered/graph families render better and their gallery images are regenerated to match.
New
- Graphviz DOT & Dippin front-ends —
DOTParser.parse(_:)/DippinParser.parse(_:)produce theFlowchartIR, so any.dot/.dipfile renders through the same layout on every backend (Apple CoreGraphics, Linux Silica/Cairo, terminal). - Render an already-parsed diagram —
MermaidRenderer.pngData(diagram:)/image(diagram:)/rgbaRaster(diagram:)(with bounded raster dimensions). NodeShape.hexagonand.subroutine.mermaidkit-term(experimental) — renders Mermaid/DOT/Dippin in the terminal, best tier first: Kitty graphics → half-block truecolor → colored box-drawing → ASCII, with capability + background detection. Platform-free, runs headless on Linux/CI.
Layout
- Edge labels center on the arrow-free run midpoint with reserved stub length, crowded parallel captions stagger, back-edges route up a gutter, needless jogs straighten, and fan-out edges spread onto distinct tracks. New linter rules ratchet it:
label-on-fixture,label-crowds-edge,edges-doubled.
Full notes in CHANGELOG.md.
🤖 Generated with Claude Code
v1.1.0 — parseWithMetadata + perf fixes
Additive, output-identical refinements on top of 1.0.0.
New
MermaidParser.parseWithMetadata(_:)— parse and get the extracted YAML front-matter (title,accTitle,accDescr) back in one call as(diagram, DiagramMetadata), avoiding a second scan over the source.
Performance (rendered output byte-identical)
Shared-pipeline fixes, verified against the draw-vs-scene conformance ratchet:
- text measurement is memoized — each label is typeset once, not at both layout and draw;
- the render cache key hashes the source once and keys by reference instead of rebuilding an interpolated string every call.
The one profiled optimization that didn't pan out — an 8-bit sRGB render backing store — measured ~2× slower than the f16 default on Apple silicon and was rejected (documented negative result).
Docs
A full performance memo (methodology, per-type numbers, where the time goes) at docs/notes/performance.md, a terminal-rendering-capabilities note, and the coverage audit reconciled against 1.0.
Site: https://2389-research.github.io/MermaidKit/ · Full changelog in CHANGELOG.md.
v1.0.0 — stable release
MermaidKit 1.0 — native Mermaid diagrams in Swift, no JavaScript, no WebView.
Thirty diagram types parsed, laid out, and rendered natively — CoreGraphics/CoreText on Apple, Silica/Cairo on Linux — with layout quality machine-checked in CI. The public API is now frozen.
What 1.0 is
- 30 diagram types, end to end: flowchart, sequence, class, state, ER, gantt, pie, timeline, mindmap, journey, quadrant, packet, xychart, kanban, radar, treemap, gitgraph, sankey, requirement, C4, architecture, block, and more.
- Native rendering on Apple and Linux. Same layout and per-type draw code behind one
CGContextseam: CoreGraphics on Apple, Silica/Cairo/FontConfig on Linux (behind theLinuxRasterpackage trait). - Machine-checked layout quality. A geometry linter and a draw-vs-scene conformance ratchet gate every fixture in CI — layout regressions fail the build, not the eye.
- Clean
from:consumption on every platform. Silica and its transitive graph are gated behind theLinuxRastertrait (default OFF), so Apple andfrom:-pinned hosts resolve a Silica-free graph.
New in 1.0
- Line breaks in labels.
<br>in every form (<br>,<br/>,<br />, case-insensitive, with attributes), a literal\n, and any real newline break box/node labels and sequence notes onto multiple lines — the box grows to fit. Fixed chrome (legends, chart axes) collapses them to a space.
Stability stance
The entry points — MermaidParser, DiagramLayoutEngine, DiagramScene, DiagramLayoutLinter, MermaidRenderer, MermaidView, DiagramTheme — are stable. As of 1.0, model/layout field changes are semver-major.
Requirements
Swift 6.2 / Xcode 26. Platforms: macOS 14+, iOS 17+, visionOS 1+, and Linux. MermaidLayout is zero-dependency and platform-free; MermaidRender is CoreGraphics on Apple and links Silica only on Linux when LinuxRaster is enabled.
Install
.package(url: "https://github.com/2389-research/MermaidKit.git", from: "1.0.0")Known issue
A cross-process layout-ordering nondeterminism in a few non-layered types (the layered/flowchart family is deterministic), tracked as #1.
See CHANGELOG.md for the full history.