Live data from Hacker News

D2: A new declarative language to turn text into diagrams

d2-lang.com

31–40 of 130 posts

Re: D2: A new declarative language to turn text into diagrams

#31

Earlier quoted context omitted.

graphviz svg output can be (with some tricks) CSS-styled + JS-animated, so the sky is the limit w.r.t. how fancy you want to make you DOT graphs, and their elements.

actually the effective limit seems to be around 50 nodes

Limit of what exactly? I've made much bigger than 50 nodes SVG-graphs using GV, and styled them with probably 50+ CSS styles and animated more than 50 nodes.

So, could you please elaborate?

Re: D2: A new declarative language to turn text into diagrams

#32

Time for someone to copy the good parts and implement them as FOSS. Good luck getting enterprises to pay for diagrams.

At the end of the video the presenter mentions that they plan to open source the language when it reaches a greater stage of maturity.

A code dump does not make it an open source project. Sustainable OSS projects are developed publicly.

Re: D2: A new declarative language to turn text into diagrams

#33
post #4

The last question in the FAQ makes it clear that this can only be used in the context of their account-based online tool. Their free offering literally says "3 diagrams". Above this, the FAQ tries to compare their tool to Mermaid, Graphviz, PlantUML which are all open source, locally runnable, etc. Their comparison totally skips the fact that, because D2 can only be used in their service, a broad number of use cases…

This is a complete non starter for any regulated industry. Shame. Mermaid works almost okay and often looks like garbage. I wish there was an open source effort somewhere to do better, or even a paid locally runnable tool that has no service connections.

It won't work for every use case but https://flowchart.fun is one open-source alternative

Re: D2: A new declarative language to turn text into diagrams

#35
post #17

I am taken a little aback by the name. There is, of course, already the D programming language, which has even had a major version number of 2 for quite some time. It also brings to mind the JavaScript library d3, which, while not strictly for making diagrams, can easily lend itself to the purpose. Calling this thing "D2" seems potentially confusing.

We have:

"D" the programming language [0]

"D" the data language specification [1]

"D" the programming language for DTrace [2]

"D3" the javascript library [3]

"D4" library/tool for Declarative Data-Driven Documents[4]

"D4" implementation[5] of the data language specification[1]

Overall, I think "D2" is objectively the best choice here. We have at least three "D"s, two "D4"s, and one "D3", so it makes sense to put it in as "D2". I certainly wouldn't want another "D" or, heaven forbid, a "D5".

[0]: https://en.wikipedia.org/wiki/D_(programming_language)

[1]: https://en.wikipedia.org/wiki/D_(data_language_specification...

[2]: https://en.wikipedia.org/wiki/DTrace#Description

[3]: https://d3js.org/

[4]: https://github.com/joelburget/d4

[5]: https://en.wikipedia.org/wiki/Dataphor#Languages

Re: D2: A new declarative language to turn text into diagrams

#37
post #29

https://plantuml.com/ is free and nice. Plays well with Markdown and C4 diagrams. The only UML-specific diagram type I use is the sequence diagram but that is very useful IMHO.

It can be a bit clunky setting up the jar (or hosting it yourself), but it's still the best worst option. It scales pretty well and can draw some very complex flows, while still giving you the best in just plain ole text editing.

I could have never maintained the diagrams I used for other developers on my teams or folks on the audit/regulation side of thing without it.

The default styles are really unprofessional looking and I think a lot of folks look the other way once they see that. C4 diagraming with PlantUML is also a breeze for systems diagrams.

https://github.com/plantuml-stdlib/C4-PlantUML

Re: D2: A new declarative language to turn text into diagrams

#38
post #8

See also: https://structurizr.com/ - diagrams as code https://c4model.com/ - C4 model for visualising software architecture The consistency of structurizr + c4 is great for sharing information across scaled teams of teams.

also:

The XState Visualizer generates nice looking statecharts.

https://stately.ai/viz

Click See an example in the left pane, then click Visualize at the bottom of the right pane.

On the roadmap are visualizations for XState's actors facility, i.e. multiple statecharts interacting with one another.

If you login, you can save/fork statecharts and get shareable links for them. There doesn't seem to be a way to export the diagrams (as PNG or SVG) but maybe that will be added in the future.

Re: D2: A new declarative language to turn text into diagrams

#39
post #4

The last question in the FAQ makes it clear that this can only be used in the context of their account-based online tool. Their free offering literally says "3 diagrams". Above this, the FAQ tries to compare their tool to Mermaid, Graphviz, PlantUML which are all open source, locally runnable, etc. Their comparison totally skips the fact that, because D2 can only be used in their service, a broad number of use cases…

People seem to be missing that this is a preview, not a product (yet). And that: "When the language is more stable, we intend to open source D2. This will happen sometime in 2022."

In D2 Tour video, at 4:30, they say

> When it's more stable, we will be open-sourcing the language.

If thats the case, that only the language will be open-sourced, not the visualization, then I'm not entirely sure what that really gets you, beyond perhaps alternative editors?

But its the layout algorithms that are actually notable.

Re: D2: A new declarative language to turn text into diagrams

#40
post #4

The last question in the FAQ makes it clear that this can only be used in the context of their account-based online tool. Their free offering literally says "3 diagrams". Above this, the FAQ tries to compare their tool to Mermaid, Graphviz, PlantUML which are all open source, locally runnable, etc. Their comparison totally skips the fact that, because D2 can only be used in their service, a broad number of use cases…

This is a complete non starter for any regulated industry. Shame. Mermaid works almost okay and often looks like garbage. I wish there was an open source effort somewhere to do better, or even a paid locally runnable tool that has no service connections.

It's why I keep falling back to excalidraw over tools like mermaid with auto-layout. When I need to communicate an idea, often I really need to fuss with layout in order to get my point across, and having the control to drag things around is the only way to get there.
Post reply on HN