Those "news" (commercials in disguise) about d2 consistently fail to make it clear that even though the language itself is opensource, the primary backend for it isn't, and is actually quite expensive. There're free backends, but those have inferior capabilities.
I'm not sure where you got the impression that the paid layout engine is the primary backend for it.
We set out to make our own layout engine, which we charge for, true. However to say it outcompetes the efforts of all open-source ones including ones used by Graphviz (dagre) and university researchers (ELK) is quite the compliment, and not one that we've ever made ourselves. There are simply different use cases for each: https://d2lang.com/tour/layouts .
In fact we specifically de-weight our own layout engine, making it a separate install and not referenced anywhere in the D2 project. The vast majority of D2 users aren't paying a penny.
And like another comment says, we make it abundantly clear our own layout engine is not open-source everywhere that it's mentioned.
Your claim that this is a commercial post is also unfounded. I opened HN today as a reader and was surprised to see this post.
> I'm not sure where you got the impression that the paid layout engine is the primary backend for it.
I got this impression once I failed to reproduce the examples in your documentation with free backend.
> However to say it outcompetes the efforts of all open-source ones including ones used by
> Graphviz (dagre) and university researchers (ELK) is quite the compliment,
I did not mean to say that your engine outcompetes the open-source ones, but rather that d2 gives inferior results with them.
> Your claim that this is a commercial post is also unfounded.
I keep seeing thinly disguised d2 promos on the front page and this raises a few questions. This is fairly niche product, and far from unique in its capabilities. Why would it keep showing up among highest-ranked posts?
> I got this impression once I failed to reproduce the examples in your documentation with free backend.
This is easily verifiably false. All the examples have direct links to the playground to reproduce, except the few explicitly called out in the layout section as belonging to TALA's. If you still claim this, simply provide a link to an example that doesn't explicitly say it's made with TALA in the docs (d2lang.com).
> I did not mean to say that your engine outcompetes the open-source ones, but rather that d2 gives inferior results with them.
I'm not sure you understand the role layout engines have. All languages like PlantUML etc just abstractly represent nodes and connections and choose some styles for them. The rest is layout engine.
> Why would it keep showing up among highest-ranked posts?
You're engaging in conspiracy theories and there's nothing further I can prove short of an HN mod telling you these are legitimate unrelated posters and upvoters.
It was unmaintained for a long time (maybe considered done implementing the algorithm it set out to), but recently a Google engineer has revived it: https://github.com/dagrejs/dagre
Pikchr https://pikchr.org/home/pikchrshow is the other general purpose one and older than d2. It is "Source-Code License: 0-clause BSD" as it says on the page.
Also, it won't be long before ChatGPT or similar models will do the same thing. A specialized text-to-diagram generator is a pointless thing to work on, IMHO, except for the fun of it.
You might as well say that, because of the telephone, we will no longer need sound.
I think you misunderstand how ChatGPT generates images. ChatGPT can only generate text: somebody at OpenAI wrote additional software to handle images, and connected it up to ChatGPT. (I believe ChatGPT is prompting an image model based on DALL-E, though who really knows what's going on in proprietary SaaSS?)
It's not a magic box that, left alone, will inevitably and inexorably transform into the solution to all the world's problems. If ChatGPT is ever capable of producing diagrams, it will be because of systems like this.
I have no doubt that it's possible to design an algorithm that can produce diagrams in a given style, given a sufficient description. But a GPT is only going to learn that sort of thing via sufficiently-many examples.
This problem is fundamentally different to (e.g.) computer chess, in that we have no algorithmic win condition. You can't brute-force a solution space when your only way of assessing whether candidates are any good is to ask a human. (Especially not when humans use heuristics to assess the quality of something at a glance, and find it tiring to process large quantities of data: that's a simple recipe for specification gaming if ever I saw one.)
I think it will be long time before ChatGPT can make system diagrams of real systems. It can make a plausible diagram of a fake system, but that's basically worthless.
Pikchr https://pikchr.org/home/pikchrshow is the other general purpose one and older than d2. It is "Source-Code License: 0-clause BSD" as it says on the page.
D2 is fantastic. You can customise a lot of stuff in the diagrams with free layout engines. And it spits out SVGs which you can tweak with an editor (like Affinity Designer).
I have a bunch of styles which I always dump in D2 to generate consistent looking diagrams. Might be useful if you have a design system and you want to give your diagrams branded look and feel.
I also tried to figure out how to write a custom layout engine but apparently I need more weekends of time to work on it.
A few days ago I had to create an architectural diagram for my client. I found d2lang and liked its visual style a lot. Then I quickly found your blog entry/tutorial thanks to an old HN post which allowed me to complete the diagram in about 1 hour. Thanks a ton for having it published, I know that I will be a frequent user of d2lang now and that is also thanks to your article which contains all important instructions for a reader to successfully get started with d2lang.
While you're here: while skimming I noticed under the headline Connections one of the samples has the wrong label. Instead of `Gordon <-> Mia: ->` it should be `Gordon <-> Mia: <->`
I've been looking everywhere for a diagraming software that supports filter by dependency. I want to spec out all my systems and their feature responsibilities and dependencies. But the chart get's so big and busy. What If I want to look at feature A in my UI and do a directed search down to find all it's dependencies in services and db. Or I want to click some part in the server, and have it reverse that looking at all the upstream features that might be effected. Ideally it would filter out all the non-connected nodes, and re-layout.
At some point, I'd like to commit it to sourcecode and require updates for PRs. Then have CI attach an image of the affected features when adding something new.
Was hoping this might have something like that, but doesn't look that way. I've also looked at MermaidJS and Lucid charts :\
I also prefer d2 over mermaid, from the language perspective. But mermaid integration is currently just so much better; there is support (native or via plugins) for Google Docs, GitHub, Confluence, and many more. For me that’s the killer feature that tipped the scale for MermaidJS
The VSCode plugin still requires me to install software in the computer itself.
Mermaid may be slightly more cumbersome to write, but the ease of setting it up everywhere and the way it integrates all over the place is much superior.
Also the pricing for the TALA engine, which is presumed to be where the future of d2 and whatever future differentiating features it may get, is pretty crazy for personal use.
Even ignoring the rude name-calling, I usually find that these kind of comments are poorly thought-out and come from an unrealistic idea of name ownership. I wasn’t familiar with any other D2 and want to give the benefit of the doubt, so I went through a few pages of search results for “D2 language”. Didn’t see any other projects. Are you thinking of the D3 JavaScript charting library?