D2 Diagrams
D2 is a modern diagram language that turns text into diagrams. It focuses on readability and produces clean, well-laid-out output.
Basic flow
Section titled “Basic flow”Shapes and containers
Section titled “Shapes and containers”Sequence diagram
Section titled “Sequence diagram”Class diagram
Section titled “Class diagram”Grid layout
Section titled “Grid layout”Syntax
Section titled “Syntax”Use a fenced code block with the d2 language identifier:
```d2x -> y -> z```D2 supports many diagram types and features including containers, connections, shapes, icons, and themes. Diagrams render as SVGs with automatic dark mode support.