214 points · by dcu · 3y ago · 70 comments
The biggest new thing since last time D2 was here is that we now have a playground for folks to easily check it out without installing: https://play.d2lang.com.
Also just to preface the top discussion points that arise when D2 is shared:
> "What's the difference between this and--"
https://text-to-diagram.com. We made it. The maintainers of Mermaid themselves have contributed to it.
> "The name!"
I like this guy's reply: https://news.ycombinator.com/item?id=33704960
> Is there a proprietary aspect?
Yes, we're a for-profit company. D2 is 100% FOSS, and we make an alternative layout engine which we sell (Jetbrains model, i.e. your copy is your's forever if you've paid for 12+ months). It's a separate install, not packaged with D2, so you won't see it if you don't want it. D2 is perfectly usable without it, and integrates with multiple free open source layout engines (e.g. the one that Mermaid uses, "dagre", is D2's default).
I'm tempted to give it a shot, but i don't get what the paid version would actually net me. I'm toying with the Playground now, and in many (most?) cases the TALA version (which i think is the paid version?) seems identical to the Dagre version (Mermaid, i think?)
I'm also having difficulty finding where i'd even buy it. Hmm
edit: Ah https://terrastruct.com/tala/ might have some of my answers
I have an improvement suggestion for the playground: have some pre-defined examples I can open from a menu and mess around with.
Did I understand correctly that, in order to use custom fonts, one has to recompile the code with appropriate .tff files? It's shortly mentioned [1].
[1] https://github.com/terrastruct/d2/tree/master/d2renderers/d2...
Re fonts: that README is for contributing fonts. I'm not sure what the best solution is for custom fonts -- whether to just specify the name of a system font, a google font, point to a directory of local TTFs. Some discussion going on here: https://github.com/terrastruct/d2/discussions/132
D2 is that fake corporate "open-source" intended to sucker programmers into tying their work into proprietary ecosystem.
https://binaries.templates.cdn.office.net/support/templates/...
https://play.d2lang.com/?script=VJDNbqswEIX3fopZ3R34J3EuRUqr...
Formatting is completely different. Each box is a picture on the left with text on the right. Text is two lines, bold text above and regular text below. this can be reproduced with HTML labels in Graphviz.
Lines do not look similar too. They are round and not merged. It's concentrate in Graphviz. https://graphviz.org/docs/attrs/concentrate/
I followed the submission link but found no details of pricing on that site.
(apologies for this hidden path. trying to strike the balance of making it findable for those who search for it while hidden to those who just want free.)
I'm talking about that D , aka D2, aka DLang has been using this name for a lot of years. This would create a lot of awful confusion!
D3 is the mythical version that would fix all D shortcomings, keeps being talked about when we have those long community rants, but that is about it, there is no project going on.
Btw, is there a succinct comparison to GraphViz?
GraphViz is perheps a little tedious to write, and takes some work to make look good (which makes me appreciate the D2 style), but is also definitely possible in my experience.
E.g. SciPipe (https://scipipe.org) outputs pipeline diagrams in this style:
https://www.researchgate.net/profile/Samuel-Lampa/publicatio...
I'm not familiar with EPS. Will investigate, ty. https://github.com/terrastruct/d2/issues/489
GraphViz is included.
The URL for PlantText returns a 404. You might want to update that to just planttext.com
D2 seems like a nice upgrade:
- it has an even more intuitive syntax (which is really important for something used on-and-off by any individual developer).
- it seems to have better graph routing
However there are two things keeping us from trying it:
- not supported in our tools, most notably no mdbook plugin yet. I imagine this will change over time
- readability: node labels are tiny compared to nodes, meaning you have to zoom in much more and lose view of the larger structure
Re support: yeah it's a long queue we're making our way through. We have VSCode, Vim, Obsidian, about to roll out Slack, Discord, working on Github, etc. Somewhere down the line, mdbook will be on the chopping block. (community has also contributed plugins for TreeSitter and Emacs)
Re node labels. Yeah this has come up a few times now. We'll have something that addresses it in the next release. For now, you can change font-size:
https://play.d2lang.com/?script=cspPUtC1U3DMyUxOtVKo5lJQAPvX...
I have since settled on just using excalidraw, with the vscode plugin it is easy to save/version the diagrams alongside my projects and embed them as ordinary image files in docs.
I have a standing Google alert for UML threads, because I've been looking for a long while for a good resource on what makes a good diagram. Not how to make it or what to make it with; like a Tufte for diagrams... Anyway D2 seems to make it easy to make clean diagrams.
I have been wanting to implement the C4 model, for something, since recently learning about it but haven’t yet. And I generally have used Visio and PowerPoint for these things.
https://d2lang.com/tour/text#how-do-i-position-text
After creating a somewhat complex "systems diagram" I also have a mixed feeling if the more verbose syntax compared to Mermaid actually is an advantage.
https://play.d2lang.com/?script=PJG7qsJAEIb7eYofTp0XSHFELMTa...
https://mermaid.js.org/syntax/flowchart.html
Is mairmaid plantuml or why is plantuml chosen as the comparison point?
The markdown embedding and integrated rendering in gitlab is really useful.
a: { b: { c: { d } } }
x: { y: { z: { z1 } } }
a.b -> x.y.z
https://play.d2lang.com/?script=SrRSqE6yUqhOtlKoTqmtreXiqrBS...