10 ms·
D2 language, open source alternative to PlantUML
- contr-error 4y agoThanks for sharing, looks really nice. Way less verbose and more intuitive syntax than PlantUML. Also seems to drop some vestigial UML aspects, like those default icons in the top right of PlantUML boxes (although I don't really grok UML). Title is somewhat ambiguous, since PlantUML is open source as well. 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.
- mdaniel 4y agopreviously: https://news.ycombinator.com/item?id=33704254 https://news.ycombinator.com/item?id=33704254
- mcqueenjordan 4y agoThis is great, we need more tools like this -- diagrams that can be version controlled, iterated/edited on alongside the code, etc. I think there's so much room for innovation in the area of declarative diagramming.
- tragomaskhalos 4y agoI am working on a project where all documentation is in markdown and plantuml for precisely these reasons, and honestly I'm surprised at how seamless the transition has been from the usual world of Word docs plus ad-hoc diagramming tools (cough PowerPoint cough). Easy diffability is another big benefit.
- bmitc 4y agoHas anyone used this? Would this be what people would suggest if choosing a new text-based visualization tool? 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.
- peter_retief 4y agoI just tested it, really helpful for me to simply set my thoughts visually without using bloated apps like Visio and PowerPoint
- jhoechtl 4y agoOverall it works well. There are some rough edges though. Textual annotations do not work well and are nowhere visually pleasantly placed "near" where they should perceptually go. https://d2lang.com/tour/text#how-do-i-position-text 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.
- bmitc 4y agoInteresting, I see in your link that it supports MathJax, which is awesome and was a question I just had before following your link. I actually needed that recently. I was using Mermaid, but I am not aware of Mermaid supporting MathJax or KaTeX.
- alixanderwang 4y agoD2 offers 3 layout engines. 1 of them we made and 2 open source ones. Each have their limitations, and "near" is a keyword that's only supported in TALA right now. (it's there in the docs you linked) https://play.d2lang.com/?script=PJG7qsJAEIb7eYofTp0XSHFELMTaIqVMMqMb2GTDXlzF5N1lV7EZGP5vLvBxDi1eBFjHcunZ8jyoR_MPXkZCqaWRnja6DdYl-eCcovkF36RO5UCkj8XyzMVKi3USAv7QmSfEIStSUOy7846ABqcIwwGT84q0xHFSRMMzjoeysiKdwvBdcfWqGLzKGAOt9Y3ioK1HN3oHAAD__w%3D%3D&layout=tala https://play.d2lang.com/?script=PJG7qsJAEIb7eYofTp0XSHFELMTa...
- ofrzeta 4y agoYou can use C4 with PlantUML. https://github.com/plantuml-stdlib/C4-PlantUML https://github.com/plantuml-stdlib/C4-PlantUML
- _ix 4y agoThank you for sharing this.
- ysleepy 4y agoReminds me of Mairmaid https://mermaid.js.org/syntax/flowchart.html 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.
- sam_lowry_ 4y agoI've been using plantuml in gitlab for a while...
- liotier 4y agoSame - I read about Mermaid, D2 etc. but, at the end of the day, I'll use whatever is available on the corporate Gitlab !
- yeslibertarian 4y ago
- Zardoz84 4y agoSeriously, no body do a little research before naming his public projects to see if some other public project had the same name that are you about to use ? 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!
- byteware 4y agois D2 another name for the D language? there is also a D3 project
- pjmlp 4y agoYes D2 is what current D version used to be called when D1 was still around, about 10 years ago. 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.
- hobofan 4y agoIn many peoples interpretation D3 will be https://d3js.org/ https://d3js.org/.
- hackerman123469 4y agoIt's fine in that case since that's a framework and not a language.
- Zardoz84 4y agoEven If no body name it now as "D2", creating a totally unrelated project called "D2Lang" would generate a lot of confusion with D and "Dlang"
- radarsat1 4y agoMaybe people should stop naming things after single letters in the alphabet? Just an "out there" idea, I know.
- lf-non 4y agoI don't have anything against the text to diagram tools, however as someone who has to create/tweak diagrams only 2-3 times in a month, I always find myself forgetting the syntax and needing to refer the docs for these utils. 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.
- alixanderwang 4y agosame. even I refer to our docs sometimes. This helps: https://d2lang.com/tour/cheat-sheet https://d2lang.com/tour/cheat-sheet
- smusamashah 4y agoI have a list of more tools like this here https://xosh.org/text-to-diagram/ https://xosh.org/text-to-diagram/
- genezeta 4y agoNice list. Thanks :) The URL for PlantText returns a 404. You might want to update that to just planttext.com
- alixanderwang 4y agoWe link to this in the README for text-to-diagram.com, and it was a starting point for us when we were researching what's out there when designing D2. Thank you for maintaining this.
- alixanderwang 4y agohi HN, I'm Alex, my team and I made D2. 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 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 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 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).
- sendfoods 4y agoCongrats on the release! I gave it a spin before the launch of the playground, and really liked it 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/d2fonts https://github.com/terrastruct/d2/tree/master/d2renderers/d2...
- alixanderwang 4y agoThanks! We actually released a couple weeks ago, and since then it's been almost 100% fixing/improving things the community's surfaced. Long list of stuff here: https://github.com/terrastruct/d2/releases https://github.com/terrastruct/d2/releases. 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 https://github.com/terrastruct/d2/discussions/132
- porker 4y agoWhere's the pricing for your layout engine TALA? I detest the results from dagre so interested in this. I followed the submission link but found no details of pricing on that site.
- signa11 4y agodupe: https://news.ycombinator.com/item?id=33704254 https://news.ycombinator.com/item?id=33704254
- wongarsu 4y agoSo far, for our diagraming needs we've used MermaidJS, embedded as code blocks into our Markdown documentation (github and mdbook for us, but support is pretty wide). 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
- alixanderwang 4y agothank you! 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=cspPUtC1U3DMyUxOtVKo5lJQAPvXSiEjtVKRS0EBHjhWCqamXLVcgAAAAP__&layout=elk&theme=0 https://play.d2lang.com/?script=cspPUtC1U3DMyUxOtVKo5lJQAPvX...
- darkteflon 4y agoHi there, I’ve been following the Obsidian plugin development and noticed that it appears to be done but not yet listed in the Community Plugins? Is it likely to be available soon, do you know?
- alixanderwang 4y agoit's been in their open PRs for like 3 weeks now: https://github.com/obsidianmd/obsidian-releases/pull/1389 https://github.com/obsidianmd/obsidian-releases/pull/1389. Maybe they just have all hands on deck for that launch they did today. Hopefully soon!
- alixanderwang 4y ago
- maeln 4y agoPlantUML is also open-source. The title make it look as if it is not.
- deleted 4y ago[deleted]
- froh 4y agoThe PlantUML license is slightly chaotic though, it's provided under several licenses, and each bundle has subtle differences in behavior which are not spelled out. https://plantuml.com/download https://plantuml.com/download
- samuell 4y agoNice! I like the default aesthetics! 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 https://scipipe.org) outputs pipeline diagrams in this style: https://www.researchgate.net/profile/Samuel-Lampa/publication/326761313/figure/fig1/AS:654994197987328@1533174194487/Figure-Directed-graph-of-workkkow-processes-in-the-Genomics-Cancer-Analysis.png https://www.researchgate.net/profile/Samuel-Lampa/publicatio...
- justusw 4y agoI think one advantage in GraphViz is the ability to output EPS. I use this often for embedding into PDF via XeLaTeX and Pandoc filters. I also saw that D2 offers some kind of LaTeX output, but was not able to dig into the docs there further.
- alixanderwang 4y agoYeah it's just Mathjax equations. E.g. https://play.d2lang.com/?script=PNCxCsJADIfxPU_xH1uk4NzBJwlIkAtXTFs9r3iQ5t2lDl2_5YPfy2R51nXBcIOuZd5MRnwnM3xqEqOzOQHpvclBPWI3qakRADDbNN89g7kcfv8xrggwa5GHa9cuuR-0a314DgJ2CvoFAAD__w%3D%3D&layout=dagre https://play.d2lang.com/?script=PNCxCsJADIfxPU_xH1uk4NzBJwlI... I'm not familiar with EPS. Will investigate, ty. https://github.com/terrastruct/d2/issues/489 https://github.com/terrastruct/d2/issues/489
- justusw 4y agoI appreciate it! Mscgen also supports EPS, but I realize D2 is way, way more general, so having one tool and one syntax for everything would be great.
- nine_k 4y agoI suppose converting SVG to EPS should be relatively straightforward; some converters exist.
- 4y ago
- xigoi 4y agoAlso see Pikchr: https://pikchr.org/home/doc/trunk/homepage.md https://pikchr.org/home/doc/trunk/homepage.md
- Daedren 4y agoIt does look nifty, but without the tooling, I don't see myself replacing Mermaid anytime soon. For example, VSCode doesn't have live previews for D2 which makes it awkward to work with.
- devin 4y agoMy kingdom for an Emacs plug-in.
- alixanderwang 4y agohttps://github.com/andorsk/d2-mode https://github.com/andorsk/d2-mode
- lloydatkinson 4y agoHow do you prevent lines going through titles in containers? a: { b: { c: { d } } } x: { y: { z: { z1 } } } a.b -> x.y.z
- alixanderwang 4y agoWe're working on this. We had some label avoidance code in TALA, and we're trying to find ways to make other layout engines play nice with it. https://play.d2lang.com/?script=SrRSqE6yUqhOtlKoTqmtreXiqrBSqK60UqiuAmFDsFCiXpKCrp1ChV6lXhUXIAAA__8%3D&layout=tala https://play.d2lang.com/?script=SrRSqE6yUqhOtlKoTqmtreXiqrBS...