Mermaid.js renders the diagrams on this blog. The
source lives in .mmd files and is compiled to static SVG at build time, so
each diagram ships as a plain image with no client-side JavaScript.
Temperature by Day of Week
More Examples
Flow Chart
Sequence Diagram
State Diagram
Task Priority Matrix
Git Flow
Entity Relationship
Pie Chart
Usage in Markdown
Each diagram is a .mmd file under src/diagrams/<post>/. For example,
src/diagrams/mermaid-diagrams/flow-chart.mmd:
flowchart LR
Start --> Process --> End
bun run render:diagrams compiles every .mmd to a matching SVG under
public/ using a shared theme, then the post embeds the result as a static
image:
<figure className="static-mermaid-figure">
<div className="static-mermaid-frame">
<img
className="static-mermaid-diagram"
src="/mermaid-diagrams/flow-chart.svg"
alt="A short description of the diagram"
width="{496}"
height="{712}"
/>
</div>
</figure>
A diagram that needs custom colors can ship a sibling .mmd-named .css file,
which the renderer inlines into the SVG so the image stays self-contained.
Bonus: Code Blocks with Shiki
Code blocks get syntax highlighting at build time via Shiki.
Bash:
k get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 51d v1.33.1
k8s-2 Ready control-plane 51d v1.33.1
k8s-3 Ready control-plane 51d v1.33.1
Rust:
fn main() {
println!("Hello, world!");
}