Render Mermaid diagrams as SVGs or ASCII art
Posted by mellosouls 15 hours ago
Comments
Comment by joopie 1 minute ago
I've worked on a similar project, but instead of going the ASCII route, we decided to lean into interactivity for code exploration. The angle is more around empowering human understanding, instead of agent understanding. We also chose D2 (and are looking to support Mermaid soon too).
Would love to hear others' thoughts on whether interactivity for humans is more valuable vs context for agents.
Comment by tempaccsoz5 14 hours ago
Comment by forgotpwd16 5 hours ago
https://github.com/AlexanderGrooff/mermaid-ascii/blob/master...
https://github.com/lukilabs/beautiful-mermaid/blob/main/src/...
Comment by AlexanderGrooff 11 hours ago
Comment by adiian 4 hours ago
Comment by pancsta 2 hours ago
Comment by btucker 26 minutes ago
Playground here: https://btucker.github.io/selkie/
One of the cool features is it can use kitty to output diagrams direct to the terminal (if kitty is supported like in ghostty).
I'm planning to blog about the whole process soon.
Comment by thangalin 12 hours ago
My Markdown editor, KeenWrite[2], integrates Kroki as a service. This means whenever a new text-based diagram format is offered by Kroki, it is available to KeenWrite, dynamically. The tutorial[3] shows how it works. (Aside, variables within diagrams are also possible, shown at the end.)
Note that Mermaid diagrams cannot be rendered by most libraries[4] due to its inclusion of <foreignObject>, which is browser-dependent.
[1]: https://kroki.io/
Comment by ycombiredd 3 hours ago
There's an example of a fairly complicated graph of chess grandmaster PGM taken from a matplotlib example from the NetworkX documentation website, among some more trivial output examples in the README at https://github.com/scottvr/phart/blob/main/README.md#example...
(You will need to expand the examples by tapping/clicking on the rightward-facing triangle under "Examples", so that it rotates to downward facing and the hidden content section is displayed)
Comment by afro88 8 hours ago
--
To me, the diagrams have an uglier default design. A crazy amount of dropdown shadow (in the examples), stretched fonts (front page example). It doesn't matter how many diagram types you support if the generated diagrams aren't good quality.
Mermaids defaults are good enough. They're not amazing, but I'm also not embarrassed to show them to other engineers, stakeholders etc
Edit: KeenWrite looks excellent btw
Comment by jbstack 7 hours ago
Comment by afro88 6 hours ago
Comment by dmos62 8 hours ago
[0]: https://github.com/AlexanderGrooff/mermaid-ascii
I think I ran into a bug, the "start" edge is not rendered. This is from https://agents.craft.do/mermaid:
stateDiagram-v2
[*] --> Idle
Idle --> Active : start
Active --> Idle : cancel
Active --> Done : complete
Done --> [*]
┌──────────┐
│ │
│ │
│ │
└─────┬────┘
│
│
│
│
▼
┌──────────┐
│ │
│ Idle │
│ │
└─────┬────┘
▲
│
cancel
│
▼
┌─────┴────┐
│ │
│ Active │
│ │
└─────┬────┘
│
│
complete
│
▼
┌──────────┐
│ │
│ Done │
│ │
└─────┬────┘
│
│
│
│
▼
┌──────────┐
│ │
│ │
│ │
└──────────┘Comment by smilingleo 10 hours ago
ASCII diagrams are inherently constrained by printable characters, which makes them hard to standardize and limits their expressiveness compared to proper diagram renderers.
Comment by benrutter 9 hours ago
In those contexts, rendered mermaid as html isn't an option, so this really does seem like one of the best calls for human readability.
Comment by gregoriol 9 hours ago
Also Claude code in the terminal can show them.
Comment by jbstack 7 hours ago
Comment by dmos62 7 hours ago
Comment by esafak 3 hours ago
Comment by tuetuopay 9 hours ago
Comment by jonfw 15 hours ago
A good monospaced font and they can look really sharp!
I will definitely give this tool a shot.
I will also shout out monodraw as a really nice little application for building generic ASCII diagrams- https://monodraw.helftone.com/
Comment by mixmastamyk 14 hours ago
Comment by hahahahhaah 13 hours ago
Comment by tracker1 1 hour ago
Adjacent... I am somewhat curious if a well crafted rust library/app might work better via WASM since it's a relatively simple input/output scenario... I've done similar for input sanitization tasks in the past and it worked better than JS/TS.
Comment by tnkuehne 1 hour ago
Comment by rahimnathwani 14 hours ago
Subgraph Direction Override: Using direction LR inside a subgraph while the outer graph flows TD.
With this, you should be able to approximate swim lane diagrams, which is something Mermaid lacks.The last time I checked, Mermaid couldn't render subgraphs in a different direction than the overall graph.
Comment by smusamashah 12 hours ago
I have a list of text to diagram tools here https://xosh.org/text-to-diagram/ but not many are text to ascii. There are a few text to ascii sequence diagram tools.
Comment by brumar 9 hours ago
Comment by a_t48 14 hours ago
Comment by csmantle 14 hours ago
Comment by intellectronica 1 hour ago
Comment by robin_reala 8 hours ago
(Mermaid isn’t accessible by default either, but there’s current work in that direction: https://github.com/mermaid-js/mermaid/pull/7349)
Comment by ozim 7 hours ago
Comment by Terretta 13 hours ago
While great for individuals, it's particularly strong out-of-the-box for teams, or even teams of teams with two levels of grouping.
They bring the same ... craft (ahem) ... to the whole product as shown in their Craft Agents or this renderer, with a strong foundation originally started in the Markdown philosophy. Check out the founder's story on their About page for a refreshingly LLM-free backgrounder.
Comment by dleeftink 14 hours ago
Comment by jackconsidine 14 hours ago
Im sold. Love mermaid but totally agree.
Comment by reboot7417 10 hours ago
Comment by mjaniczek 6 hours ago
Comment by Lio 4 hours ago
I wonder if we can get the ASCII render to run inside Vim/NeoVim?
Comment by nulone 13 hours ago
Comment by dizhn 9 hours ago
Comment by rcarmo 9 hours ago
Comment by doanbactam 13 hours ago
Comment by LeonidBugaev 12 hours ago
Getting AI to generate valid mermaid diagrams on scale extremely hard. With maid i'm hitting 100% accuracy.
Maid is basically built from scratch mermaid parser, without any dependnecies, which knows how to auto-fix common AI slop diagramming issues.
Comment by peanutz454 13 hours ago
Comment by peter_retief 9 hours ago
Comment by wyes 14 hours ago
Comment by altano 9 hours ago
Comment by lubujackson 13 hours ago
Comment by apwheele 12 hours ago
So for the "All Edge styles"
graph TD
A[Source] -->|solid| B[Target 1]
A -.->|dotted| C[Target 2]
A ==>|thick| D[Target 3]
Results in the ascii ┌──────────┐
│ │
│ Source ├─thickted─────┐
│ │ │ │
└─────┬────┘ └─────┼────────────────┐
│ │ │
│ │ │
solid │ │
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ │ │ │ │ │
│ Target 1 │ │ Target 2 │ │ Target 3 │
│ │ │ │ │ │
└──────────┘ └──────────┘ └──────────┘
(The svg for this example is maybe misleading, as it looks like un upside down T) But the ascii here has the overlapping words, and you cannot tell the difference in any of the lines.The Parallel links, example mermaid
graph TD
A[Input] & B[Config] --> C[Processor]
C --> D[Output] & E[Log]
results in ascii ┌───────────┐ ┌────────┐
│ │ │ │
│ Input │ │ Config │
│ │ │ │
└─────┬─────┘ └────┬───┘
│ │
│ │
│ │
│ │
▼ │
┌───────────┐ │
│ │ │
│ Processor ├◄─────────┤
│ │ │
└─────┬─────┘ │
│ │
│ │
│ │
│ │
▼ ▼
┌───────────┐ ┌────────┐
│ │ │ │
│ Output │ │ Log │
│ │ │ │
└───────────┘ └────────┘
This is just wrong isn't it? Why is there an arrow from config to log?Comment by wrboyce 8 hours ago
Comment by dochtman 8 hours ago
https://github.com/1jehuang/mermaid-rs-renderer
Just submitted a HN thread about it:
Comment by cjlm 14 hours ago
Comment by patrick4urcloud 8 hours ago
Comment by maximgeorge 11 hours ago