Tuesday, November 22, 2022

D2 Diagram Scripting Language

Terrastruct (via Hacker News):

D2 is a modern diagram scripting language that turns text to diagrams.


D2 is built to be hackable -- the language has an API built on top of it to make edits programmatically.


D2 is designed with language tooling in mind. D2’s parser can parse multiple errors from a broken program, has an autoformatter, syntax highlighting, and we have plans for LSP’s and more. Good language tooling is necessary for creating and maintaining large diagrams.

Text to Diagram:

Compare the syntax and renders of various languages that produce diagrams from text.

GraphViz has seemed fine to me, but:

This project has only 3 of its founders remaining as volunteer maintainers, and support is limited and may end soon. If you can help fund to a more formal foundation to continue this project, please contact north on graphviz org.

3 Comments RSS · Twitter

It would be cool, if there were MarkDown editors/viewers that could turn inline D2 into images on the fly.

I use Notion for this, which recognizes Markdown, and Mermaid for diagrams (no D2 yet)

Typora handles Mermaid.

Also, the new (to me) app that I'm enjoying right now is MWeb on macOS and iOS. It is kinda like Bear and nvUltra, but includes support for Mermaid, graphs, and tags. I used Bear for years, but having tables and diagram support built-in (instead of using Marked2.app) is really nice.

Leave a Comment