Local D2 text check
D2 Diagram Checker
Paste D2 diagram text to format indentation and arrows, and to check braces, quotes, and connections. The source stays in this browser.
No checks reported.
Checks cover braces, quotes, and connections. This page does not draw the D2 layout.
No upload. The current source stays in this tab.
What the checker looks at
A connection needs text on both sides of ->, <-, --, or ↔. Braces must pair outside of quotes, and a quote that opens must close. A # comment is ignored for the rest of that line. The sample templates are original starters for a service path, a decision, and a nested block.
What formatting changes
Format indents lines inside braces and puts spaces around connection arrows. Text inside quotes is left alone, so an arrow that is part of a label stays inside the quotes.
The picture is not drawn here
This page does not run the D2 layout engine, so it will not turn the text into the final diagram. Use it to clean and check the source, then render that text with a D2 tool you already run locally. For a diagram that this site does render, use Code to Diagram.
D2 diagram FAQ
Can this page draw a D2 diagram?
No. It formats and checks D2 text. It does not compute D2's layout or produce an SVG from that layout.
What does a connection look like?
A typical line is writer -> review: Draft. The words on the left and right name the shapes, and the text after the colon is the label. A line that starts with an arrow is missing one side.
Is D2 source uploaded?
No. Formatting, checks, copying, and download stay in this tab.