In addition to being a runnable CLI tool, D2 can also be used to produce diagrams from Go programs. For examples, see ./docs/examples/lib. This blog post also demos a complete, runnable example of ...
HTML, and other formats It supports source-only, rendered-only, and split-view modes, with real-time updates across all views. Rendered output supports code syntax highlighting, Mermaid.js diagrams, ...