1. 18
  1.  

  2. 5

    Another related tool that came up in the related HN thread is pikchr which is from the same people as Fossil and SQLite (I believe).

    It says it is like PIC, which I never really looked into, but in comparison to the more domain-level declarative languages like dot and the various uml things, pikchr seems like more of a general purpose diagram DSL.

    Once we start heading in that direction it makes me wonder if we don’t just want a full language. pikchr has some natural language bits that are kind of idiosyncratic and seem pretty specialized, but maybe if you are not trying to represent every drawable thing, it’s OK to have some syntactic sugar like this:

    box; move; circle; move; ellipse; move; cylinder
        arrow from first box.s \
              down 1cm \
              then right until even with first cylinder \
              then to first cylinder.s
    

    the relative labels like first box seem like weird ways to avoid just naming things, which you can also do.

    1. 1

      Thank you so much for mentioning Pikchr! I was looking for something exactly like this. One C file, one function, easy to use.

    2. 3

      Instant user here. This works so well!

      1. 3

        I took a closer look just now, apparently I had tried terrastruct long ago and still had an account!

        first, D2 and the commercial terrastruct tool are both really impressive and look super useful.

        I was particularly excited to see some initial work in terrastruct toward bidirectional editing - some edits are nicer to do in the UI like picking colors, drawing arrows, grouping and deleting things, and the editor will immediately reflect those edits in the text - for some things. I note that there were some things you could do in the UI that don’t result in changes to the code, so they get lost when you recompile. moving boxes around and grouping are examples.

        It seems hard to strike a balance with usability in a system like this. If you disallowed edits that couldn’t be represented automatically, you might get frustrated trying to draw, but then at least you wouldn’t lose work.

        Speaking of grouping, I couldn’t find a language reference easily, but it seems like D2 lacks some features I think would make it much more powerful, specifically an abstraction primitive to make functions so we could define how to draw a new kind of thing, and then use it in multiple places. Then some kind of module functionality to let different diagrams (and people) share common pieces also makes sense. They’ve probably thought about this, but I didn’t find anything about it on their language roadmap - https://d2lang.com/tour/future

        1. 3

          Similar tools that were already open-source include mermaid, graphviz, and plantUML.

          1. 9

            we have comparisons with all of them at https://text-to-diagram.com

            1. 3

              Sort of misses the best features of GraphViz though.. it’s layout options and tools

              eg. edge concentrators, ratio compress, neato, sccmap, tred, gvpr, unflatten

              But yes, it’s cluster mechanism is a bit klunky.

              Whilst GraphViz doesn’t do sequences something with a very very similar syntax does, namely mscgen,

              1. 3

                Most of the time I reach for graphviz, I already know what shape I want the output to be. Then I struggle to make graphviz do it.

                1. 1

                  …it has, ahhh, opinions. ;-)

              2. 3

                Oh, I have looked for something like this for years. Thanks!