This is one of the issues I’ve attempted to tackle with the Mermaid Studio plugin for IntelliJ.
It provides both syntax guides and syntax/semantic analysis as MCP Tools, so you can have an agent iteratively refine diagrams with good context for patterns like multi-line text and comments (LLMs love end-of-line comments, but Mermaid.js often doesn’t).
This has been my exact experience with agents using gradle and it’s beyond frustrating to watch. I’ve been meaning to set up my own low-noise wrapper script.
This post just inspired me to tackle this once and for all today.
Yeah, AI generated diagrams can be pretty hit or miss. The lack of good quality examples in training data and minimal documentation for these tools can make it difficult for models to even get basic syntax correct for more complex diagrams.
I’ve had a lot of success dogfooding my own product, the Mermaid Studio plugin for JetBrains IDEs (https://mermaidstudio.dev).
It combines the deep semantic code intelligence of an IDE with a suite of integrated MCP tools that your preferred agent can plug into for static analysis, up to date syntax, etc.
I basically tell Claude Code to run the generated diagram through the analysis tool, fix issues it detects and repeat until fixed. Then generate a png or svg for a visual inspection before finalizing the diagram.
Now all of my planning and architecture docs are filled with illustrative flowcharts, sequence diagrams, and occasionally block diagrams for workshopping proposed UI layouts
One major downside of native rendering is the lack of layout consistency if you’re editing natively and then sharing anywhere else where the diagram will be rendered by mermaid.js.
This is a perfect use case! The v0.3.0 crate will have:
- parse() → AST
- layout() → positioned elements
- render_svg() → SVG string
- render_png() → via resvg (no browser needed)
CLI usage would be something like:
mermaid-rs diagram.mmd -o diagram.png> # or pipe from stdin> cat diagram.mmd | mermaid-rs --format svg > output.svg>
For your mark integration, you'd be able to call it as a subprocess or use it as a Rust library directly if you're building in Rust.
If you want to follow progress or have input on the API, feel free to open an issue on the repo!
Markdown viewing is one of the core use-cases I had in mind when building the Tachi Code browser extension (https://tachicode.com/).
Open a raw .md file in your browser and it'll automatically open in a side-by-side editor/preview. If viewing is all you want, you can set the default preview mode for markdown files to be fullscreen.
Well you see he ran it through in through an LLM, but LLMs are lossy, so who can say if the output was a direct result of the copyrighted code or if the model focused on his unique prompting words and conjured the output from its own latent space without referencing copyrighted input at all? /s
Alternatively, we could take the model makers’ view and say that if they didn’t want their code reused, they wouldn’t have made it publicly accessible on the internet.
the model makers opinion is no different than "if she didn't want to be ogled/cat called, she shouldn't have been wearing [insert literally any type of clothing here] when travelling from A to B in a public place"
I’ve used this library on a couple of projects with great results. One, a drag-and-drop IaC builder and the other a GitHub Actions-like task execution graph viewer.
There’s a pattern to emoji use in docs, especially when combined with one or more other common LLM-generated documentation patterns, that makes it plainly obvious that you’re about to read slop.
Even when I create the first draft of a project’s README with an LLM, part of the final pass is removing those slop-associated patterns to clarify to the reader that they’re not reading unfiltered LLM output.
It provides both syntax guides and syntax/semantic analysis as MCP Tools, so you can have an agent iteratively refine diagrams with good context for patterns like multi-line text and comments (LLMs love end-of-line comments, but Mermaid.js often doesn’t).
reply