Skip to content

Diagram Guide

MkDocs-Kit integrates 7 diagram engines that render directly from fenced code blocks in your Markdown sources. No external build steps, no image files — the SVG output is embedded inline in every HTML page and PDF.


Supported Engines at a Glance

Engine Block Fence Best For Renderer
PlantUML ```plantuml UML diagrams (Sequence, Class, Activity, Gantt…) System plantuml binary
WireViz ```wireviz Cable harnesses and connector pinouts wireviz Python package
RackDiag ```rackdiag Data center server rack layouts rackdiag Python package
PacketDiag ```packetdiag Network protocol header field maps packetdiag Python package
ByteField ```bytefield Hardware register and bit-field maps bit_field Python package
BlockDiag ```blockdiag General-purpose block flow diagrams blockdiag Python package
NwDiag ```nwdiag Network topology and subnet diagrams nwdiag Python package

How It Works

During the MkDocs build, the DiagramsPlugin scans every Markdown page for fenced blocks whose language tag matches one of the above engines. It replaces each block with its rendered SVG output, wrapped in a <div class="diagram-{type}"> container.

┌─────────────────────────┐       ┌──────────────────┐       ┌────────────────────┐
│   Markdown source file  │       │  DiagramsPlugin  │       │   HTML output page │
│                         │  -->  │  (on_page_mark-  │  -->  │                    │
│  ```plantuml            │       │   down hook)     │       │  <div class=       │
│  @startuml              │       │                  │       │   "diagram-        │
│  A -> B                 │       │  renderers.py    │       │    plantuml">      │
│  @enduml                │       │  render_plantuml │       │   <svg>…</svg>     │
│  ```                    │       │  → inline SVG    │       │  </div>            │
└─────────────────────────┘       └──────────────────┘       └────────────────────┘

The resulting SVGs scale correctly in both the HTML site and the PDF output (constrained to max-height: 22cm for A4 pages).


Quick-Reference Example

Each engine section in this guide provides 2–3 realistic examples. Here is one from each engine:

PlantUML — State Diagram

DisconnectedConnectingConnectedActiveconnect()session oksubscribe()error / drop

RackDiag — Server Rack

blockdiag 1 2 3 4 5 6 7 8 9 10 11 12 Firewall Core Switch App Server [2U] DB Server [2U] NAS [2U]

PacketDiag — UDP Header

blockdiag 0 16 32 Source Port Destination Port Length Checksum

BlockDiag — Build Pipeline

blockdiag Commit Build Test Lint Package Deploy

NwDiag — Network Topology

blockdiag lan 10.0.0.0/24 10.0.0.10 server 10.0.0.20 client

Per-Engine Detailed Pages

See the individual pages in the Diagrams section of the navigation for comprehensive examples, syntax references, and rendering tips for each engine.