Diagramming support on the TBP forum

As folks develop real-world Monty instances, they may wish to document the data flows. It appears that Discourse has extensions to support diagramming in DOT (i.e., Graphviz) and Mermaid, but this needs to be enabled:

I realize that I can generate image files elsewhere and then copy them into the forum, but this is rather inconvenient. Might TBP be willing to turn on one or both of these plugins?

-r

2 Likes

This is a good idea, thanks Rich!

Internally, in the docs, we use mermaid so I’ve turned that on site-wide. :tada:

pie title NETFLIX
         "Time spent looking for movie" : 90
         "Time spent watching it" : 10
2 Likes

Thanks for enabling Mermaid; I’ll give it a try RSN. That said, I’ve been using DOT for several decades and find it far more capable than Mermaid for the sorts of things it does (e.g., depictions of directed graphs). So, if there’s a way to safely enable it, I’d be very appreciative.

-r

As promised, I gave the embedded Mermaid support a try:

Mermaid musings: simple graphs of actors

As someone who has used DOT extensively over a few decades, I’m not pleased with Mermaid’s limitations (details upon request :-/). However, I was able to create some simple diagrams with relatively little pain.

I’d like to be able to see the “source code” for forum postings, both for my own edification and the possible generation of bug reports. It appears that there is a “Raw Post Button” theme component that allows this. Could you look into setting it up?

Raw Post Button will add a button to the post menu. When you click the button, you’ll get a modal / popover with the raw (markdown) version of the post.

Done.

2 Likes

It took me a second to find the Raw Post button. First, I had to click the ellipsis in the terminating line of icons. Then, I had to hover over each icon to find out its meaning. That said, it then worked Just Fine…

1 Like

I’m still playing around with the forum’s Mermaid support, over at Mermaid musings: simple graphs of actors. If anyone wants to see some workable ways to use and format Mermaid code, check out the snippets in those postings.

FWIW, I’d still like the forum admins to check into supporting DOT (part of the Graphviz suite). It’s quite a bit like Mermaid, but it allows more complex and interactive diagrams.

With mermaid I always start here https://mermaid.live and then paste into the forum/readme. It’s fully client-side which I’m sure helps keep the server lean and stable

2 Likes

Mermaid is very cool and does many different types of plots, but (IMNSHO) it doesn’t do node-and-edge diagrams of graphs as well as (say) DOT/Graphviz. It also lacks the ability to specify much about diagram layout. I’m not sure what the right answer is, aside from just living with its limitations and filing issues (I’m not about to dive into that huge a JS project. :-)

One rather weird possibility might be to:

  • have a tool such as DOT generate diagrams in SVG
  • have a LLM-based chatbot move the nodes around
  • use the result in Discourse, GitHub Pages, etc.

On a related note, I’ve been looking into how far I can push ChatGPT’s UI, using Markdown, prompts, rules, etc. For example, I’ve been finding that long chats quickly become unwieldy, both during the session and afterwards.

So, I’d like to add progressive disclosure (e.g., turny triangles), for use in the sessions and afterwards. For example, I might want to dump (part of) a session transcript (in Markdown et al) for use on Discourse (etc) forums, GitHub Pages, etc.

FYI, I’ve been quite successful at telling ChatGPT exactly how I want its emitted code to be formatted (e.g., add blank lines and spaces to make it easier to read, order the functions just so). It seems quite willing to (re)generate huge piles of (highly plausible) code in any language I might specify.

Details at 11…

As I’ve mentioned before, I consider Graphviz to be far more capable than Mermaid for creating diagrams of graphs. I also have some issues with Markdown’s limitations (e.g., no include syntax, macros, etc.). I’ve often thought about hacking my way out of these annoyances, but it always seemed like Too Much Work™.

Hackity Hack…

However, having recently started using Codex CLI, I decided to create a GitHub Page generator that would allow me to use my preferred tooling and idioms. It’s still in its early stages (and very ugly), but it already lets me:

  • define macros (e.g., $WP/Foo for a Wikipedia link)
  • use Graphviz commands to generate SVG images
  • use Python scripts to edit broken SVG images
  • generate and display both locally and on GitHub.

Although Codex had a Really Hard Time with one of the diagrams (I have no idea why :-/), it eventually worked out a solution. This involved writing a Python script to edit the generated SVG image, something that I would never have attempted on my own.

Having hand-crafted and machine-generated Graphviz diagrams in the past, I have a pretty good idea of how long all this would have taken me without help (basically, forever :-). Getting something plausible running in a single (looong) coding session showed me that this is a very powerful tool, indeed. So, I definitely plan to keep at it…

Results and Prospects

The initial result of this work is Dotty explorations, a page that starts with some diagrams I posted in this forum, but goes on to use some layout tricks that are far beyond Mermaid’s capabilities.

Sadly, I don’t think that much of this tooling will be usable for Discourse forums, in that it relies on GitHub Actions, Make, Python scripts, etc. Still, some folks here might find it interesting…