3 ms·
D2: Declarative Diagramming – A modern language that turns text to diagrams
- Flux159 2y agoI like it - was just making a diagram for a container architecture & used Mac OS Freeform, but I could keep this in my repo easily & update via text. Also, like that there’s an online playground for trying it out.
- vouwfietsman 2y agoThe big question with these is always: how does it layout? Having text to diagram is great until you have moderately complicated diagrams that turn into a mess using the automated layout engine. Apparently though, these people know what they're doing and wrote their own, specific for software architecture! Very curious to see if it works well.
- pbronez 2y agoPretty cool that they have multiple layout engines: Layout engines dagre (default): A fast, directed graph layout engine that produces layered/hierarchical layouts. Based on Graphviz's DOT algorithm. ELK: Also a directed graph layout engine. More mature than dagre, better maintained (part-time academic research team working on it), with recent releases. TALA: New layout engine designed specifically for software architecture diagrams. https://d2lang.com/tour/layouts/ https://d2lang.com/tour/layouts/
- ygra 2y agoAutomatic layout can work really well if the diagram kind is known. E.g. you don't have that many arbitrary placement options for a flowchart as opposed to an arbitrary diagram. In those cases of your layout algorithm produces an okay result, most people won't miss options to change certain parts of the automatically-laid out diagram. I think I'm that's a major part why solutions like PlantUML, Mermaid, or D2 often require you to specify a diagram type: to restrict the layout to what makes sense for that diagram. That's a problem that plagues more generic options like Graphviz or (disclaimer: I work on that) yEd where you get the generic layout options and have to adjust them to make sense for your diagram. More flexible, but also more cumbersome, often with the problem that you crave for manual adjustment if the layout is not quite right.
- Veuxdo 2y agoPrevious discussions: - https://news.ycombinator.com/item?id=32652291 https://news.ycombinator.com/item?id=32652291 - https://news.ycombinator.com/item?id=34064921 https://news.ycombinator.com/item?id=34064921 - https://news.ycombinator.com/item?id=39805529 https://news.ycombinator.com/item?id=39805529 - https://news.ycombinator.com/item?id=36224084 https://news.ycombinator.com/item?id=36224084 - https://news.ycombinator.com/item?id=42033790 https://news.ycombinator.com/item?id=42033790 Edit: looks like submitter is spamming https://news.ycombinator.com/newest https://news.ycombinator.com/newest with old submissions
- deleted 2y ago[deleted]
- Svoka 2y agoI don't see clear way of embedding this except generating images manually then embed images. If d2 has all what it claims to have, why not just provide a way to embed diagrams into markdown rather than having it in separate files
- betimsl 2y agoHey, just as an idea, how about having a struct.from.go(`type my struct{...`) copy/paste go code. This way cognitive load of the user is less because we would not need to remember/lookup d2 syntax when writing coding diagrams.