Skip to main content
Pick a diagram block by what you need from it: The typed fences (graph, sequence, steps) follow the shared rules for steps, meta strings, playback, and validation.

graph

Nodes and edges. Omit x/y and the layout places nodes for you: dagre for architecture and flow diagrams, layered for DAGs and trees, circular for small dense graphs. Refer to an edge as "from->to", or give it an id. Nodes take shapes such as person, cylinder, queue, and cloud, and groups draws labelled containers behind their members. A bare graph fence renders when its body has nodes. Also spelled kiwi-graph, widget:graph.

sequence

A message sequence between participants: API flows, consensus rounds, handshakes, retries. Each playback step reveals one more message, so steps only needs a note per message. frames draws grouping boxes such as alt [cache miss]. A bare sequence fence renders when its body has participants. Also spelled kiwi-sequence, widget:sequence, seq.

steps

A Mermaid diagram walked one step at a time. Each step can focus or dim node ids and carry a note. For a sequenceDiagram, each step reveals one more message unless you set messages. Unlike other typed fences, each step stands alone instead of patching the previous one. A steps fence needs a non-empty steps: list. A bare steps fence renders when its body has diagram. Also spelled kiwi-steps, widget:steps, mermaid-steps.

mermaid

A standard ```mermaid block renders as a diagram. Add focus= or dim= to the opening line to emphasize or fade node ids, and use Mermaid’s click directive to make a node open a page, a heading anchor, or an external URL.
The linter rejects an empty mermaid block, or one whose first line isn’t a Mermaid diagram type such as flowchart, sequenceDiagram, or stateDiagram. To step through a Mermaid diagram, use steps.

d2

A ```d2 block is rendered to SVG by the KiwiFS server, in-process, and follows the web UI’s light or dark theme.
  • Layout. dagre by default. Choose elk with D2’s vars: {d2-config: {layout-engine: elk}}. Other engines aren’t available.
  • Limits. Source up to 64 KB, 10 seconds per render. @import is disabled.
  • Errors. A diagram with a syntax error shows the source and D2’s message. If the server can’t render, for example a binary built with -tags nod2, the source is shown as a code block.
The web UI calls /api/kiwi/render/d2, which you can also use directly:
Terminal
GET /api/kiwi/render/d2?source=...&theme=light works too. The response is image/svg+xml with an ETag, and errors are 422 (diagram error), 400 (empty or too large), 503 (timeout), or 501 (built without D2).

Drawing embeds

Embed an Excalidraw drawing (.excalidraw.md) or a canvas (.canvas.json) inline with a wiki embed. Add a width (wide, full), pin to keep it in view while the reader scrolls, a pixel size such as 600x400, or caption text after the |.
To add a caption to any media, wrap it in a figure.

Widgets overview

Fence names, steps, playback, and validation.

Canvas

Spatial diagrams in .canvas.json files.

Whiteboard

Freeform drawing in the web UI.

Data structures

tree, list, and map for structures, not architecture.
Last modified on October 19, 2026