A simple, lightweight live-reload server for D2 diagrams written in Rust.
- 🔄 Instant reload - Browser refreshes automatically when you save
- 🖱️ Pan & zoom - Navigate large diagrams easily
- ⚡ Fast - Native file watching with minimal latency
- 📦 Single binary - No runtime dependencies
cargo build --release
# Binary will be at ./target/release/d2seecargo install --path .d2see <input.d2> [OPTIONS]
Arguments:
<input> Input .d2 file
Options:
-l, --layout <LAYOUT> D2 layout engine [default: elk]
-p, --port <PORT> Server port (random free port if not specified)
-b, --browser <BROWSER> Browser command (e.g. "firefox", "qutebrowser"). Uses system default if not specified
--no-browser Don't open browser automatically
-h, --help Print help
-V, --version Print version# Watch full-chart.d2 with ELK layout on a free port
d2see full-chart.d2
# Use dagre layout on port 3000
d2see diagram.d2 --layout dagre --port 3000- Start the watcher:
d2see mydiagram.d2 - Default browser automatically opens with a panzoom preview
- Edit the
.d2file in your editor (Vim, VS Code, etc.) - Save the file - browser reloads automatically
- CTRL+C creates a distributable .html file with embedded panzoom.
- D2 must be installed and available in your PATH
- A modern web browser
- Uses the
notifycrate for efficient cross-platform file watching - Runs
d2to compile.d2→.svgon each change - Serves an HTML page with the SVG embedded and pan/zoom enabled
- Uses Server-Sent Events (SSE) to trigger browser reloads