Live data from Hacker News

D2: A new declarative language to turn text into diagrams

d2-lang.com

71–80 of 130 posts

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

#71

Hi all, creator of D2 here. I posted this on Reddit to get some feedback but was hoping to improve the docs and offer a playground environment before posting on HackerNews. Ah well. I wanted to clarify some things: 1. D2 will be open source and usable outside of Terrastruct. Terrastruct will remain the best interface to D2, with bidirectional updates from GUI, but we already have vscode and vim plugins ready for loca…

It seems that open sourcing it while it is growing up actually makes more sense. If you want community involvement, ideas, testing, contributions, and so on, then hiding the project source is antithetical to why most people participate in open source in the first place.

Open source can mean more than just a license. It should mean more than just gifting a code base once you think you're done.

I don't mean to come across as bitter or entitled. I just question the value of waiting till the last minute. For now, the promise only stands as a way to pull people into the fold. I've seen this kind of promise many times before in projects much like this.

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

#72
A problem with semantic markup is when it doesn't do what you want, and you need to wig-wam it. Does this mean you actually wanted presentation markup? Or, since you are trying to convey meaning, does it mean that the semantics aren't rich enough to describe what you mean?

In this D2 example (https://d2-lang.com/assets/images/intro-example-a917149ff3b7...), the diagram is nicely designed to be centered on the nexus node crawler. But the choices of which side the tributary nodes are on is not. You might want cron below and ps->express below - or to the sides.

The grammar can be extended to accommodate this (maybe already has been), but what is the semantic meaning of above, below, left or right?

One semantic choice is made: the "persists" arc is unidirectional, and is presented left-to-right - a natural order for many languages.

(Technically, "declarative" needn't be "semantic", but arguably is the most useful one)

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

#73
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…

Those tools are mature 10-20+ year and we're just getting feedback for our little ol' alpha born ~yesterday. The limitations are temporary -- we are working on an offline, locally runnable experience (it's in the roadmap), but, alas, engineering bandwidth of a 6 person team. edit: I've updated the docs to make this clear

[deleted]

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

#74
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.

Ilograph [0] is a similar (and, in my biased opinion, better) tool that has a 100% local runtime option (called Ilograph Desktop). You can still test-drive it with the browser version, of course.

[0] https://www.ilograph.com

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

#75
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…

A simple check for an infrastructure tool (and a programming language is a king of infrastructure tools): does it have an open-source, unencumbered implementation?

If not, I won't use it for anything serious.

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

#76
I've used Plantuml extensively, and still use it a bit, now and then. I don't remember ever needing or even wanting bi-directional editing. There's a lot of interesting things in terms of syntax and semantics here, but I really do not see WHY they are tackling a very hard problem on top of an already not easy one.

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

#77

Earlier quoted context omitted.

Those tools are mature 10-20+ year and we're just getting feedback for our little ol' alpha born ~yesterday. The limitations are temporary -- we are working on an offline, locally runnable experience (it's in the roadmap), but, alas, engineering bandwidth of a 6 person team. edit: I've updated the docs to make this clear

How is this different/better than, say, Mermaid?

For one thing, the output looks lightyears better.

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

#78

A problem with semantic markup is when it doesn't do what you want, and you need to wig-wam it. Does this mean you actually wanted presentation markup? Or, since you are trying to convey meaning, does it mean that the semantics aren't rich enough to describe what you mean? In this D2 example ( https://d2-lang.com/assets/images/intro-example-a917149ff3b7... ), the diagram is nicely designed to be centered on the nexus…

If there is semantic meaning in where your options are (or you want to assign it anyway) then an automatically generated diagram is probably a bad fit.

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

#79
post #71

Hi all, creator of D2 here. I posted this on Reddit to get some feedback but was hoping to improve the docs and offer a playground environment before posting on HackerNews. Ah well. I wanted to clarify some things: 1. D2 will be open source and usable outside of Terrastruct. Terrastruct will remain the best interface to D2, with bidirectional updates from GUI, but we already have vscode and vim plugins ready for loca…

It seems that open sourcing it while it is growing up actually makes more sense. If you want community involvement, ideas, testing, contributions, and so on, then hiding the project source is antithetical to why most people participate in open source in the first place. Open source can mean more than just a license. It should mean more than just gifting a code base once you think you're done. I don't mean to come acr…

thank you for the advice, I do appreciate it, as I'm no expert in open source. one thing to clarify is the idea that we're tying a bow and chucking it across the fence. we'll be far from finished when we open source d2. the intention was to internally seed the initial design (of both the language and the code) -- the first minute of building -- quickly, within a small team. i'm really grateful for all the interest today from everyone, hopefully HN will let me post the repo to update people shortly (w/o considering it a dupe).

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

#80
> D2 has no diagram types. In other tools, you specify "this is a class diagram", or "this is a state diagram". One of the goals of D2's design is to have minimal syntax that you compose with.

I think this can be really difficult...?

I was fiddling with RDF and N-ary relationships some time ago, but the easiest way to express a complex relationship is to pre-define the whole relationship as an entity, and relate it to actual entities. This ends up with something similar to function call (e.g. score(subject: playerA, object: playerB, using: weapon, when: time)) or RDBMS tables.

But "no DSL-in-DSL" should be a right direction. The core language should be carefully designed to allow modular approaches.

Post reply on HN