Skip to content

markdown-d2

markdown-d2 turns D2 diagrams into pictures in a site built with zensical or Python-Markdown. You write a diagram as text in a d2 code block, and the build draws it, once for the light theme and once for the dark one. Your readers get the picture with the page: they download no extra software, and they can step through the diagram and open it full screen.

A web request
browserservercachedatabase HTTPSlook upqueryrefresh
browserservercachedatabase HTTPSlook upqueryrefresh

This picture comes from this block:

```d2 title="A web request"
browser -> server: HTTPS
server -> cache: look up
server -> database: query
cache -> database: refresh
```

Because the build draws every diagram, a mistake in one stops the build with a message naming the page, the diagram and the line, so a broken picture never reaches your readers.

Where to go next