Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

d2lab

Small, focused repo for authoring D2 diagrams. Sources live in diagram/ and exports are written to output/ via small helper scripts and mise tasks.

Icon Set

Quick start (Dev Container)

Prereqs: Docker + VS Code.

  1. Open this repo in VS Code and run: "Dev Containers: Reopen in Container".
  2. The container will run scripts/setup.sh to install D2 and Playwright (for PNG export).
  3. Start watching a diagram and auto-regenerate SVG on save:
mise run watch ./path/to/diagram
  1. Build all outputs on demand:
mise run build ./path/to/diagram

Watch mode writes ./output/diagram.svg. Build mode writes ./output/diagram.svg, ./output/diagram.png, and ./output/diagram.gif.

Local setup (without Dev Container)

mise trust
mise install
npm -g install playwright
npx playwright install --with-deps chromium

Now you can use the same tasks:

mise run watch ./path/to/diagram
mise run build ./path/to/diagram

Helper scripts

PowerShell:

powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\d2_watch.ps1 ./diagram/homelab.d2
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\d2_build.ps1 ./diagram/homelab.d2

Bash:

./scripts/d2_watch.sh ./diagram/homelab.d2
./scripts/d2_build.sh ./diagram/homelab.d2

Sponsor

If this project helps you, consider supporting it:

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Sponsor this project

Used by

Contributors

Languages