That “Parse Error” Feeling: Why We Gave Our Diagram Tool an AI Brain

We’ve all been there. You’re trying to map out a system, a user flow, or just a simple idea. You open a “Diagrams-as-Code” tool like Mermaid.js because you’re a developer, and that’s what you’re supposed to do.

Ten minutes later, you’re staring at a “Parse Error” message, ready to throw your keyboard across the room.

You missed a quote. You used a parenthesis instead of a bracket. You forgot a semicolon. This strict, unforgiving syntax, which is great for computers, is often a massive pain for humans.

Diagrams are supposed to clarify thinking, not add friction to it. This frustration is the exact reason we started our project: The Mermaid Diagramming and Charting Tool. We decided that if the tool was going to be “dumb,” we’d give it an AI brain to help out.

What if Your Editor Was an Expert Partner?

Our idea was simple. What if, instead of just being a text box, your editor could act like a senior developer or a design expert, looking over your shoulder and offering helpful advice?

So, we built it.

We created a simple, clean, web-based tool where you can type Mermaid code on one side and see your diagram appear on the other. But unlike other editors, we added a few “magic” buttons.

These buttons connect our simple editor to the powerful Google Gemini AI. We built a secure “middle-man” (a simple script on our server) that passes your diagram and your questions to the AI, so your private API keys are never exposed in the browser.

This AI integration allows our tool to do three things that feel like pure magic.

The 3 Magic Features

1. The “Ugh, Just Fix It!” Button

This is the most-used feature. The moment our tool sees that dreaded “Parse Error,” a new button appears: “Fix with AI.”

When you click it, the tool doesn’t just send your broken code to the AI. It also sends the exact error message it received. It’s like telling a doctor, “It hurts here.”

The AI, acting as a Mermaid.js expert, reads the error, finds the mistake in your code—that missing end, that unquoted string—and simply fixes it for you. The parse error vanishes, and your diagram appears. It’s the “undo” button for your frustration.

2. The “Make It Pretty” Button

Sometimes your diagram works, but it’s just plain ugly. You have long sentences that overlap, nodes are crammed together, and it’s unreadable.

This is where the “Improve with AI” button comes in.

When you click this, you’re asking the AI to put on its “designer” hat. It scans your diagram for things that are hard to read. Its main trick? It intelligently finds long lines of text and inserts Mermaid-compatible line breaks (<br>) to make them wrap nicely. It turns a messy, wide diagram into a clean, well-formatted, and professional-looking chart.

3. The “Change Its Personality” Button

This one is the real game-changer.

You’ve just finished a complex flowchart. It’s perfect. And then your manager asks, “This is great, but can I see this as a sequence diagram? I want to see the order of events.”

In the past, this meant starting from scratch. A whole new file. A whole new syntax.

With our tool, you just select “Sequence Diagram” from a dropdown menu and hit “Convert with AI.”

The AI doesn’t just look at the syntax. It reads and understands the meaning of your flowchart. It identifies the actors, the steps, and the relationships. Then, it rewrites your diagram in a completely new format, preserving the core logic. You can turn a flowchart into a mind map, a class diagram into a list, or anything in between. It’s like a universal translator for your ideas.

Why This Matters

This isn’t just about making prettier diagrams. It’s about lowering the barrier to good design and documentation.

Tools like Mermaid are powerful, but their steep learning curve scares people away. Our project proves that AI can act as the ultimate “pair programmer” or “helpful assistant.” It bridges the gap between a human’s idea and the machine’s strict rules.

By building AI into the workflow, we’ve turned a tool that was often frustrating into one that feels collaborative. It’s a small step, but it’s a peek into a future where our tools don’t just tolerate us—they actively help us.

We built this tool at UTM to solve our own headaches. We hope this concept inspires others to think about how AI can make all our development tools a little more human.