Write D2 diagrams in VS Code and see them drawn beside the text as you type. The D2 engine is built in, so there is nothing else to install. Works offline. Made by Zovo.
A live D2 preview next to the editor. It draws again a moment after you stop typing, and it keeps your zoom and position while you edit.
Pan with the mouse, zoom with the wheel or the + and - buttons, Fit to see the whole diagram, 100% for actual size.
The preview follows VS Code: a dark VS Code theme gets a dark D2 theme, a light one a light D2 theme, unless the .d2 file sets its own.
Pick any of the 20 D2 themes for one preview, change the layout direction or turn on the sketch style. Only the preview changes: the extension never touches your VS Code theme or your settings.
Errors show as red squiggles in the editor with the line number, in the Problems view and at the top of the preview, where a click jumps to the line. The last good drawing stays in place until the text is fixed.
Click a shape in the diagram and the editor jumps to the line where it is written.
Diagrams with layers, scenarios or steps get a board list in the preview toolbar.
Copy the diagram as SVG text with one click.
ZOVO PRO AVAILABLEOne-time purchase · No subscription
Add Pro tools to D2 Diagram Viewer & D2 Preview
Export PNG, PDF and SVG. The diagram as PNG (1x to 4x), PDF or SVG with scale, padding and theme; one board or every board (layers, scenarios, steps), or one animated SVG.
Batch export. Every .d2 file of a folder to SVG in docs/diagrams (or your folder) in one run, with a watch mode that renders a file again when it changes.
Yes. D2 Diagram Viewer & D2 Preview is free and MIT licensed.
How do I install D2 Diagram Viewer & D2 Preview?
Click "Install in VS Code" above, or search for zovo.zovo-d2-viewer in the Extensions view.
Marketplace README snippet (copy link for VS Code Marketplace)
See full docs & install options at [vscode.zovo.one/extensions/zovo-d2-viewer/](https://vscode.zovo.one/extensions/zovo-d2-viewer/), browse all Zovo VS Code extensions at [vscode.zovo.one](https://vscode.zovo.one/), or explore [Zovo Pro](https://vscode.zovo.one/pro/).
Free. Subtitles, picture-in-picture, frame steps. MP4 viewer, MOV viewer and video player for VS Code that plays MP4, MOV, MKV, WebM and AVI with the sound VS Code mutes. AAC sound in MP4 and MOV plays with no install (built-in decoder); MKV, WebM and AVI need ffmpeg. Supports .srt and .vtt subtitle
TIFF viewer and TIF viewer for TIFF and GeoTIFF files in VS Code. Multi-page stacks, 16-bit and float data with auto contrast, pixel values, tags and PNG export. Offline.
XMind viewer and mind map viewer for VS Code. Opens XMind 2020+, XMind Zen and XMind 8 files with every sheet as a tab, relationships, boundaries, summaries, markers, notes, pictures and LaTeX equations. Also opens FreeMind .mm and OPML. Search, collapse, PNG, SVG and Markdown export. Free, works of
Mermaid preview and live editor, free: edit .mmd files and mermaid blocks in Markdown with a live diagram preview side by side, completion, error lines, templates and PNG or SVG export. No sign-in, no AI, works offline. Optional Zovo Pro adds PDF, workspace and on-save export.