Hi HN, I made lini over the past few months, It's a small language for drawing figures from plain text, compiled to SVG by a single Rust binary. Same syntax for flowcharts, sequence diagrams, mindmaps, ER schemas and charts, and also circuit schematics, floor plans and dimensioned engineering drawings.
A small one looks like this:
{ |svc::box| { fill: --teal-wash; stroke: --teal-ink } }
|group| "Services" [ |svc#api| "API"; |svc#auth| "Auth" ]
|svc#db| "Postgres"
api -> db "read"
auth -> db "write"
{ } is style, [ ] is children, and naming two nodes draws a link. lini routes it around whatever is in the way.
The SVG has no JS in it. Every colour is a CSS variable with a light-dark() pair, so one file follows the reader's dark mode, and one line of CSS on the page recolours all the diagrams on it.
It's also fast and deterministic, about 2 ms for a typical figure and byte-identical output every run, so the SVGs diff cleanly in CI. You don't need Node or a headless browser to render anything.
The playground on the site is the same compiler built to wasm. There's also cargo install lini, plugins for mdBook, remark (Docusaurus/MDX) and Astro, and extensions for VS Code and Zed. Repo: https://github.com/monfa-red/lini
Would really like to hear what breaks, or what you'd want it to draw that it can't
1 comment
[ 0.25 ms ] story [ 12.1 ms ] threadA small one looks like this:
{ } is style, [ ] is children, and naming two nodes draws a link. lini routes it around whatever is in the way.The SVG has no JS in it. Every colour is a CSS variable with a light-dark() pair, so one file follows the reader's dark mode, and one line of CSS on the page recolours all the diagrams on it.
It's also fast and deterministic, about 2 ms for a typical figure and byte-identical output every run, so the SVGs diff cleanly in CI. You don't need Node or a headless browser to render anything.
The playground on the site is the same compiler built to wasm. There's also cargo install lini, plugins for mdBook, remark (Docusaurus/MDX) and Astro, and extensions for VS Code and Zed. Repo: https://github.com/monfa-red/lini
Would really like to hear what breaks, or what you'd want it to draw that it can't
Thanks