zmermaid
I finally got zmermaid to a point where I consider it usable. 403 KB compressed.
It is a small, self-contained library written in Zig that takes Mermaid syntax and produces SVG.
No Mermaid runtime, Node.js, Java, ELK, server, or pile of downloaded assets is needed.
It can run directly in a browser as WebAssembly or as a native library, with JavaScript, C, and Zig APIs.
Project: https://github.com/t90/zmermaid
Minimal HTML + JavaScript example
<!doctype html>
<html>
<body>
<div id="diagram"></div>
<script type="module">
import { createRenderer } from "./web/zmermaid.mjs";
const wasmBytes = await fetch("./zmermaid.wasm")
.then(r => r.arrayBuffer());
const renderer = await createRenderer(wasmBytes);
const svg = renderer.render(
"flowchart LR; A[Input] --> B[SVG]",
{ theme: "dark", idPrefix: 1 }
);
document.getElementById("diagram").innerHTML = svg;
</script>
</body>
</html>