Live data from Hacker News

Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

github.com

41–50 of 110 posts

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#41
post #8

I liked Mermaid but unfortunately LLMs don't understand it well, so I switched to Latex tikz which LLMs know pretty well. At least I know Gemini 2.5 Pro does a good job at tikz. 3.7 and o1 were meh.

deepseek r1 understands mermaid very well and can correct all the mistakes of Gemini and Claude

I can second this. I’ve been using R1 to both straight up generate mermaid as well as making custom mermaid syntax generators for dynamic diagramming

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#44

One of my favorite applications of multimodal LLMs thus far is the ability to: 1. Draw a DAG of whatever pipeline I’m working on with pen and paper. 2. Take a photo of the graph, mistakes and all. 3. Ask ChatGPT to translate the image into mermaid.js Given how complicated the pipelines are that I’m working with and the sloppiness of the hand drawn image, it’s truly amazing how well this workflow works.

Alternatively, ask the LLM to create a mermaid DAG of your current code.

That's an interesting idea. A lot of times what I'm drawing is a blend of what the code is versus what I want it to be post-refactor.

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#45

One of my favorite applications of multimodal LLMs thus far is the ability to: 1. Draw a DAG of whatever pipeline I’m working on with pen and paper. 2. Take a photo of the graph, mistakes and all. 3. Ask ChatGPT to translate the image into mermaid.js Given how complicated the pipelines are that I’m working with and the sloppiness of the hand drawn image, it’s truly amazing how well this workflow works.

Care to share your prompt(s)? I draw a fair bit on a Kindle Scribe. I’d love to try this, but I bet your prompt would be helpful.

There's really not much to share. I rewrite the prompt each time, but here's was a recent one:

> I have an image of a hand drawn workflow diagram. I’d like to turn it into a mermaid.js file.

(with the image attached)

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#46

One of my favorite applications of multimodal LLMs thus far is the ability to: 1. Draw a DAG of whatever pipeline I’m working on with pen and paper. 2. Take a photo of the graph, mistakes and all. 3. Ask ChatGPT to translate the image into mermaid.js Given how complicated the pipelines are that I’m working with and the sloppiness of the hand drawn image, it’s truly amazing how well this workflow works.

I recently did a variation of this where instead of drawing, I just drafted a quick few bullet points and text describing at a high level what the system should do. And then I asked chat GPT to identify use cases and generate sequence diagrams for each use case in puml format (plantuml). Shockingly effective and it took about five minutes. This was a technical proposal that I shared with a few partner companies to provide a detailed plan to a customer. It came after several online meetings spaced over a few weeks of us negotiating the details. Pretty important document and it was well received. Plantuml looks decent enough that you can get away with sticking the resulting diagrams in a document.

I'm a busy person. I don't have hours of time that I can take out of my schedule to generate what I regard as write only documentation (nobody will ever read or truly value it) that ticks the box of "we have stuff to point at when somebody asks (which nobody ever will)", which has a lowish value. Sometimes it's nice to have. The above is a fine example. People will glance at it, give me a little thumbs up, and then give me permission to proceed as planned and bill accordingly. Job done. It's not a reference design that anyone will ever look at for more than a few seconds.

After a few decades in the industry, I'm extremely skeptical of the value of diagrams vs. the time required to produce them. I just don't see it. A lot of good software gets produced without them. You don't need blueprints for your blueprints, which is what source code is (a blueprint for automatically compiling into working software). People value such traits as structure, readability, conciseness in source code for a reason: it allows them to treat source code as design assets. I don't write UML, I stub out data classes and interfaces instead. And then I refactor them over and over again. Diagrams just slow me down.

But a few minutes is about on the threshold of me wasting braincycles on producing them and enrich documentation that I'm writing anyway in text form. Quickly jot down some notes. Don't waste any time whatsoever obsessing about the awkward syntax of these micro languages, and just get the essentials nailed. I bet I can get it down to like a minute or so with better LLMs and larger context windows. "Examine this project, produce an overview diagram of all the database tables". That's a prompt I'd write. In the same way, letting LLMs document code is a great use of time.

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#47
post #20

I have an almost exhaustive list [1] of browser based text to diagram tools. Some specialised tools (like https://sequencediagram.org/ ) so much better at what they do than any generic ones like mermaid. [1] https://xosh.org/text-to-diagram/

I like Mermaid fine, but nothing is perfect. I will look at your list. The tool I always wanted would let me paste in the SQL of my database schema and output a diagram of the tables and relationships. That's SQL and not Markdown or JSON or any other format. Note that DrawDB (www.drawdb.app) does this, although it does not yet handle views. But I have been happy with what it offers so far. Still, I would welcome sugg…

Since you asked for recommendations: Cacoo (https://nulab.com/cacoo/) has this function. You input your database schema SQL and it generates an editable diagram with all the relationships.

Disclaimer: I work for them. I’m the person who developed that feature.

Feedback welcome!

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#48
post #25

I don't love Mermaid and generally find it less well designed than something like Graphviz/dot. I generally find a lot of the syntax needlessly strict for something non-programmer humans are meant to interact with, but the big seller for me with Mermaid is that it works inline on GitHub. I end up creating a lot of sequence diagrams and having them as editable mermaid is very convenient. I do wish GitHub giant mermaid…

I was under the impression mermaid is a wrapper around graphviz dot.

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#49
post #5

Like PlantUML?

Nicer looking but fewer diagram types Also, AFAIK, their "render locally" story is "boot up headless chrome, good luck" which isn't great

Picking anything but PlantUML's default theme will make PlantUML look less 90's-Java. As a minimalistic solution, I already like "skinparam monochrome true" https://plantuml.com/skinparam#:~:text=Black%20and%20White. (You can go further with CSS and themes and...)

Re: Mermaid: Generation of diagrams like flowcharts or sequence diagrams from text

#50
post #6

Little weird to see this on the lead page… mermaid has been around for a long time. And in general I’ve found its real world use pretty lacking.

Its real-world use is drawing diagrams on a web page! I much prefer diagram-as-code to diagram-as-screenshot. e.g. https://sbs.johnnydecimal.com/14.23+OPS1#diagram
Post reply on HN