Diagrams
https://blog.kiarashs.ir/blog/diagrams
A fence tagged mermaid becomes a diagram:
Caption:. Mermaid is about 3 MB of JavaScript. Rather than send that to readers, the
build renders each diagram twice — once against the light palette, once against
the dark one — and inlines both as SVG. CSS shows whichever matches the
reader's theme, so switching theme swaps the diagram with no request and no
flash. During npm run dev the diagrams render in the browser instead, which
keeps the edit loop fast.
Other diagram types
Anything Mermaid supports works. A state machine:
A sequence:
When a diagram fails
A diagram Mermaid cannot parse does not break the build. The failure is reported on the console with the post it came from, and the block falls back to rendering in the browser, where the error appears in place with the source underneath it. That way a typo in one diagram costs you one diagram.
Cite this post
@misc{soleimanzadeh2026diagrams,
author = {Soleimanzadeh, Kiarash},
title = {Diagrams},
year = {2026},
url = {https://blog.kiarashs.ir/blog/diagrams},
urldate = {2026-02-02}
}Soleimanzadeh, K. (2026, February 2). Diagrams. Kiarash Soleimanzadeh. https://blog.kiarashs.ir/blog/diagramsK. Soleimanzadeh, "Diagrams," Kiarash Soleimanzadeh, Feb. 2, 2026. [Online]. Available: https://blog.kiarashs.ir/blog/diagramsKiarash Soleimanzadeh. “Diagrams.” Kiarash Soleimanzadeh, 2 February 2026. https://blog.kiarashs.ir/blog/diagrams