Lini 1.0, small language for diagrams and more, that compiles to SVG

Hey everyone,

I've been working on lini for the past 4 months. It's now stable enough for v1.x, thought I'd share it here

It's a small language for drawing figures from plain text, and one Rust binary turns it into SVG. Same syntax for flowcharts, sequence diagrams, mindmaps, org charts, tables, ER schemas and charts, and also some less usual ones like circuit schematics, floor plans and dimensioned engineering drawings.
more can be added in future versions

Small example:

{ |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. You just name two nodes to link them and lini figures out a route around whatever is in the way.

Couple of things I really cared about. The SVG has no JS in it, every colour is a CSS variable with a light-dark() pair, so the same file follows dark mode on its own and one line of CSS on your page can recolour all your diagrams. It's also fast, a typical figure is about 2 ms, and the output is byte-identical every run so the SVGs diff nicely in git.

To try it: cargo install lini then lini serve diagram.lini for a live preview. There's also an mdBook preprocessor (mdbook-lini), a remark plugin for Docusaurus/MDX, an Astro integration, and a wasm build, which is what runs the playground at https://lini.rs (docs and gallery are there too)

Would love some feedback, especially if you've hit the limits of Mermaid or others before

1 Like