d2(1) General Commands Manual d2(1) (NAME) d2 - d2 svg (SYNOPSIS) d2 [--watch false] [--theme 0] [--salt string] file.d2 [file.svg | file.png | file.pdf | file.pptx | file.gif | file.txt] d2 layout [name] d2 fmt file.d2 ... d2 play file.d2 d2 validate file.d2 (DESCRIPTION) d2 file.d2 file.svg | file.png | file.pdf | file.pptx | file.gif | file.txt . file.svg . stdin stdout - . . d2 . d2 . https://github.com/d2lang/d2 . https://icons.d2lang.com (Playground) https://play.d2lang.com (OPTIONS) -w, --watch false . $PORT $HOST . -h, --host localhost watch. -p, --port 0 watch. -t, --theme 0 () . --dark-theme -1 . --theme . D2 . / D2 . : https://github.com/d2lang/d2/issues/831. -s, --sketch false . --center flag SVG (viewbox) . --scale -1 . 0.5 . -1 SVG . 1 SVG . --font-regular .ttf (regular). Source Sans Pro Regular . --font-italic .ttf (italic). Source Sans Pro Regular-Italic . --font-bold .ttf (bold). Source Sans Pro Bold . --font-semibold .ttf (semibold). Source Sans Pro Semibold . --font-mono .ttf (monospace). Source Code Pro Regular . --font-mono-bold .ttf (monospace bold). Source Code Pro Bold . --font-mono-italic .ttf (monospace italic). Source Code Pro Italic . --font-mono-semibold .ttf (monospace semibold). Source Code Pro Semibold . --pad 100 ( ) . --animate-interval 0 SVG ( ) . SVG GIF . GIF . --browser true . 0 . -l, --layout dagre . layout . -b, --bundle true svg. --force-appendix false (tooltips) PNG . true SVG . --target . . '*' . . --target='' --target='layers.x.*' 'x' . -d, --debug . --img-cache true (cache). . --timeout 120 ( ) D2 . . --check false . --salt string (salt) . HTML HTML . . -h, --help . -v, --version . --stdout-format string (stdout). : png, svg, ascii, txt, pdf, pptx, gif. stdout (-) . --no-xml-tag false XML ( ) SVG. SVG HTML . --omit-version false D2 . --ascii-mode extended ASCII . : 'standard' ( ASCII) 'extended' ( ). (SUBCOMMANDS) layout . layout [name] . themes . fmt file.d2 ... . play file.d2 playground (https://play.d2lang.com) validate file.d2 file.d2. (ENVIRONMENT VARIABLES) . D2_WATCH -w[atch] . D2_LAYOUT -l[ayout] . D2_THEME -t[heme] . D2_DARK_THEME --dark-theme . D2_PAD --pad . D2_CENTER --center . D2_SKETCH -s[ketch] . D2_BUNDLE -b[undle] . D2_FORCE_APPENDIX --force-appendix . D2_FONT_REGULAR --font-regular . D2_FONT_ITALIC --font-italic . D2_FONT_BOLD --font-bold . D2_FONT_SEMIBOLD --font-semibold . D2_FONT_MONO --font-mono . D2_FONT_MONO_BOLD --font-mono-bold . D2_FONT_MONO_ITALIC --font-mono-italic . D2_FONT_MONO_SEMIBOLD --font-mono-semibold . D2_ANIMATE_INTERVAL --animate-interval . D2_TIMEOUT --timeout . D2_CHECK --check . D2_ASCII_MODE --ascii-mode . DEBUG -d[ebug] . IMG_CACHE --img-cache . HOST -h[ost] . PORT -p[ort] . BROWSER --browser . D2_STDOUT_FORMAT --stdout-format . D2_NO_XML_TAG --no-xml-tag . OMIT_VERSION --omit-version . (SEE ALSO) d2plugin-tala(1) (AUTHORS) D2 contributors Linux 6.12.107+deb13-amd64 September 21, 2026 Linux 6.12.107+deb13-amd64