Diagrams Without a Diagram Library
When the Tool Behind Your Diagrams Stops Being Maintained
بِسْمِ ٱللّٰهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ
Size
Spacing
Font
A diagram is a dependency
A diagram in a technical post looks like content. Usually it is also code: a library turns a few lines of text into a drawing, either in the reader’s browser or once during the build. That library is a dependency like any other. When it stops being maintained, every diagram that runs through it is stuck with the last version that worked.
This site went through three ways of drawing diagrams before settling on one with nothing left to maintain: an agent skill that draws each diagram as plain SVG. What follows is the path, what each option cost, how the new system works, and where it stops.
Mermaid in the browser
Mermaid is the common choice. Write a short description of boxes and arrows, get a flowchart. The simplest setup renders it in the browser, and on this site that meant about 1.5 MB of JavaScript on every page with a diagram.
It also brought two smaller problems. Mermaid measured the label text before the site font had loaded, so labels came out clipped; waiting for the fonts fixed that. HTML labels were cut at 200 pixels; switching them off fixed that too, but bold text and links inside labels went with them.
One post still renders its diagram this way, the audio path in the Claude Code voice post:
Static SVG at build time
The next step was to render once, at build time, and commit the result. A script turned each Mermaid file into an SVG, rewrote its colours to the site’s CSS variables and its text to the site’s fonts, and the page inlined the file. Readers got no diagram JavaScript, and one SVG followed both light and dark mode.
The renderer was beautiful-mermaid. The official mermaid-cli was tried as well. With enough configuration and post-processing it came close, but its layout was looser and took more room on the page.
Then beautiful-mermaid stopped moving. Its last release is v1.1.2, from February 2026. Its font sizes and sequence spacing are fixed in the code, so two issues asked for them as options:
No answer came from its authors. The site ended up on a private fork, installed from a local folder that the repository ignores. The diagrams kept rendering, because the SVGs are committed, but changing one now depended on a single machine: a fresh checkout cannot install the fork at all.
Three diagrams on this site still come from this pipeline, for example the name-resolution diagram here:
Three candidates
The search for a replacement read three projects from their repositories: the docs, the source and the open issues. Themes, interactivity and image export counted in a tool’s favour; what decided it is in the last row.
| zombie-mermaid | diagram-design | TanStack Charts | |
|---|---|---|---|
| What it is | A maintained fork of beautiful-mermaid: Mermaid text in, SVG out | An agent skill: instructions, templates and checking scripts; the agent draws each diagram | A chart library |
| Diagram types | 25 Mermaid types | 52 types | Charts, trees, networks; no flowcharts or sequence diagrams |
| Source of a diagram | Mermaid text | A description, or an imported Mermaid, draw.io, Excalidraw or PlantUML file | TypeScript plus data |
| Themes | 15 built in or any editor theme; colours as CSS variables, so light and dark switch live | One skin per project; light and dark as separate files by default | Follows the page’s colours and theme switch |
| Interactivity | Without scripts: links, tooltips, animated edges | Static by default; optional reveal, step-through and loop motion | Tooltips, crosshairs, selection, zoom |
| Export | SVG, PNG, a self-contained HTML viewer | SVG, PNG and PDF in preset sizes | SVG at build time; PNG, JPEG or WebP in the browser |
| What can break | A renderer with one maintainer | Nothing at run time; a reviewed copy keeps working | A young 1.0 release |
TanStack Charts was out first. It draws data charts, and does that with very little JavaScript, but it has no layered layout and no edge routing. A flowchart would mean computing the position of every box by hand. It remains interesting for this site’s one data chart, which currently loads ECharts at 354 KB gzipped, but that is a separate decision.
zombie-mermaid was the easy path. It keeps beautiful-mermaid’s renderMermaid function as an alias, offers the fork’s font sizes and sequence spacing as options. Mashallah, its maintainer answered both issues. Switching would have been close to renaming a package.
The question that stopped it was simple: what happens if this maintainer stops too? One person, a project a few months old, already at its fifth major version. The Mermaid text would survive another abandoned renderer. The look and the tooling around it would not, again.
Why a skill
diagram-design is not a library. It is an agent skill: a long instruction file, a reference page for each of its 52 diagram types, examples in light and dark, and small scripts that check the result. An AI coding agent reads it and draws each diagram by hand as SVG.
That changes what can break. There is no package to install, no renderer to keep compatible, nothing that runs when the site builds. A reviewed copy in the repository keeps working whatever happens upstream, and the output is plain SVG that belongs to the site. If the skill disappeared, every diagram would still render and could still be edited.
Hand-drawn diagrams used to be rare for a reason: placing every box, routing every arrow and keeping a set of diagrams consistent takes time. With an agent, the placing is the agent’s work, and the skill’s rules keep it in line. One accent colour on at most two elements, hairline borders, a 4 px grid, at most nine nodes per diagram, right-angled connectors. Its scripts check the geometry and the accessible structure of the SVG (a role, a title and a description for screen readers).
The trade-off is real. A Mermaid file can be re-rendered; a hand-drawn SVG cannot. Two drawing runs can lay out the same content differently, so a diagram here changes by editing the SVG, not by drawing it again. A short text note beside each SVG lists its nodes, connections and focal element, so the content stays readable and reviewable without the picture.
Reading the skill before trusting it
A skill is text that an agent follows and scripts it may run. It deserves the same reading as a dependency. Before anything was run, the review went through every script’s imports, the skill’s privacy statement, its instructions, and what it writes and where.
- No network, no telemetry. None of its scripts imports a network library or runs shell commands. The only outside library is Playwright, which the PNG and PDF export uses to drive a browser.
- One outbound request. The templates load their fonts from Google Fonts, which would send every reader’s IP address to Google. This site serves its fonts itself. The skill has a documented system-font mode that removes the link, and its own check fails if the link is still there.
- Files outside the repository. By default it saves brand profiles to a folder in the user’s home directory. Here the site’s skin lives in the skill’s style guide inside the repository instead, so another machine or another agent gets the same result.
Fitting it to the site
The skill’s examples write most colours as fixed values, with light and dark as separate files. An inline SVG on this site has to follow the theme switch, so every colour role maps to the site’s own CSS variables inside the SVG:
#umami-architecture-root { --dd-paper: var(--background); --dd-ink: var(--foreground); --dd-muted: var(--muted-foreground); --dd-accent: var(--primary); --dd-accent-tint: color-mix(in srgb, var(--primary) 8%, var(--background));}The text uses the site’s self-hosted fonts, the type sizes went up a step so labels stay readable at the width of a post, and the canvas is at most 660 pixels wide, just under the text column. A small script adds the site’s rules to the skill’s own checks: no fixed colours, no font links, no scripts, the right width, an accessible name.
bun run diagram:check src/Content/<collection>/Post_Assets/<post>/<name>.svgOne bug, one theme
The first version passed every check and looked right in dark mode. Astaghfirullah, in light mode the faint green tint behind the accented box came out pink.
The tint was mixed in the OKLCH colour space: color-mix(in oklch, var(--primary) 8%, var(--background)). The site’s light background is white, written as oklch(1 0 0). White has no real hue, but in that notation its hue is 0, which is red, and the browser took the 0 literally. Mixing interpolates the hue as well, so an 8% step toward emerald keeps a hue close to red and comes out pink. Mixing in sRGB has no hue to interpolate and gives the expected pale green. The check now rejects OKLCH mixing, and every diagram gets looked at in both themes, because this failure only showed in one.
The swatches below are computed by your browser from the site’s own colours, the same way the diagrams are. Each row mixes the emerald into the page background at rising strengths, the top row in OKLCH and the bottom row in sRGB:
In the light theme the OKLCH row runs through pink, salmon, tan and olive before it reaches green. In the dark theme it drifts through navy and teal instead, because the site’s dark background carries a slight blue hue. At 8% that teal is close to black, which is why dark mode only looked right. The sRGB row is the same plain fade in both themes. Use the theme switch at the top of the page to compare.
Before and after
The first diagram redrawn was the architecture of the self-hosted Umami analytics setup. This is the Mermaid version as it was. Two arrows run through the heading of the private zone and reach Umami a few pixels apart:
And the same content drawn with the skill. It reads left to right, Caddy carries the accent as the one public door, the tunnel is dashed, and a legend says which line is which:
Both follow the site’s theme switch. The new one lives in the Umami post, in all five languages:
Using it
The order of work for a new diagram on this site:
- Decide whether it earns a diagram. If a table says the same, use the table. Above nine nodes, make two diagrams.
- Write the text note. Nodes, connections, the focal element, and the original Mermaid if the diagram is a redraw.
- Ask the agent to draw it with the skill. It states its plan first: the type, the size, and what the node budget cuts.
- Check it. Run
diagram:check, then look at the page in light mode, in dark mode and at phone width. On a phone the diagram scrolls inside its own frame; the page must not. - Embed it. The SVG is shared by every language; only the
alttext is translated.
import Umami_Architecture from "~/Content/504_Setups_Entries/Post_Assets/0001_Umami_Analytics/umami_architecture.svg";import Mermaid_Diagram from "@components/Mdx/Import/Mermaid_Diagram.astro";
<Mermaid_Diagram alt="Request flow: ..."> <Umami_Architecture /></Mermaid_Diagram>The wrapper kept its old name. It is a plain figure around any SVG and sizes the drawing from its natural width.
For another site the steps are the same in principle: copy the skill into the repository, write a skin section for your own colour tokens and fonts, mix colours in sRGB, and inline the SVG so it can see the page’s variables.
If you would rather keep Mermaid
A skill is not the right answer for every site. If diagrams change often, if several people edit them, or if no agent is part of the workflow, text that re-renders is worth a lot. In that case zombie-mermaid is the option to look at: maintained today, close to a drop-in replacement for beautiful-mermaid, 25 diagram types, colours as CSS variables, and a command that checks every Mermaid block in a set of Markdown files.
Its cost is the one this site wanted to stop paying: the diagrams depend on a renderer, and the renderer depends on one person. Its default output also imports a font from Google Fonts, which a site that self-hosts its fonts has to strip.
Where it stops
- One old diagram redrawn so far. The two new diagrams in this post were drawn the same way and passed the same checks. Four older diagrams are still Mermaid: three static SVGs and the one rendered in the browser. They will inshallah be redrawn one at a time, and the old pipeline stays documented until then.
- Synthesized bold. Node names use weight 600, but the site loads only the regular weight of its sans-serif font, so the browser fakes the bold. Registering the real weight is still open.
- Untested parts. The skill’s own PNG and PDF export needs a Python library that is not installed here, so screenshots came from a separate browser tool. Its animation modes were not used either.
- Too early to judge. The skill lives in this repository only, and three diagrams say little about how it holds up across many.
What decided it
The question that decided it was not which tool draws the best diagram. It was what remains when the people behind the tool stop. For a renderer, the answer is a frozen version and a fork that lives on one machine. For a skill, it is a folder of instructions and a set of SVG files the site already owns. Now that an agent can do the drawing, owning the output may matter more than generating it.
Do I need an AI agent to use diagram-design?
In practice, yes. The skill is written for an agent: instructions, reference pages, examples and checking scripts. A person can read the same rules and draw by hand, but placing every box and routing every arrow is exactly the work the agent takes over. Without an agent in the workflow, a text-based renderer such as zombie-mermaid is the more practical choice.
Can one SVG follow both light and dark mode?
Yes, if two conditions hold. Every colour in the SVG is a CSS variable that points to the site's theme tokens, and the SVG is inlined into the page. An SVG loaded through an img tag cannot see the page's variables; it can only follow the operating system's preference, not the site's own theme switch.
Is a skill from GitHub safe to use?
It is text an agent follows plus scripts the agent may run, so it deserves the same reading as any dependency: what its scripts import, whether anything calls the network, what it writes and where, and what its instructions ask the agent to do. For diagram-design the only outbound request was a Google Fonts link in its templates, and the skill has a documented mode that removes it.
Web 5 of 8
Back to Web