{"id":8340,"date":"2025-11-13T21:53:54","date_gmt":"2025-11-13T13:53:54","guid":{"rendered":"https:\/\/people.utm.my\/shahabuddin\/?p=8340"},"modified":"2025-11-13T21:55:25","modified_gmt":"2025-11-13T13:55:25","slug":"that-parse-error-feeling-why-we-gave-our-diagram-tool-an-ai-brain","status":"publish","type":"post","link":"https:\/\/people.utm.my\/shahabuddin\/?p=8340","title":{"rendered":"That &#8220;Parse Error&#8221; Feeling: Why We Gave Our Diagram Tool an AI Brain"},"content":{"rendered":"\n<p>We\u2019ve all been there. You&#8217;re trying to map out a system, a user flow, or just a simple idea. You open a &#8220;Diagrams-as-Code&#8221; tool like Mermaid.js because you&#8217;re a developer, and that&#8217;s what you&#8217;re&nbsp;<em>supposed<\/em>&nbsp;to do.<\/p>\n\n\n\n<p>Ten minutes later, you&#8217;re staring at a &#8220;Parse Error&#8221; message, ready to throw your keyboard across the room.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Diagrams are supposed to&nbsp;<em>clarify<\/em>&nbsp;thinking, not add friction to it. This frustration is the exact reason we started our project:&nbsp;<strong>The Mermaid Diagramming and Charting Tool<\/strong>. We decided that if the tool was going to be &#8220;dumb,&#8221; we&#8217;d give it an AI brain to help out.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What if Your Editor Was an Expert Partner?<\/h3>\n\n\n\n<p>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?<\/p>\n\n\n\n<p>So, we built it.<\/p>\n\n\n\n<p>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 &#8220;magic&#8221; buttons.<\/p>\n\n\n\n<p>These buttons connect our simple editor to the powerful Google Gemini AI. We built a secure &#8220;middle-man&#8221; (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.<\/p>\n\n\n\n<p>This AI integration allows our tool to do three things that feel like pure magic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The 3 Magic Features<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. The &#8220;Ugh, Just Fix It!&#8221; Button<\/h4>\n\n\n\n<p>This is the most-used feature. The moment our tool sees that dreaded &#8220;Parse Error,&#8221; a new button appears:&nbsp;<strong>&#8220;Fix with AI.&#8221;<\/strong><\/p>\n\n\n\n<p>When you click it, the tool doesn&#8217;t just send your broken code to the AI. It also sends the&nbsp;<em>exact error message<\/em>&nbsp;it received. It&#8217;s like telling a doctor, &#8220;It hurts&nbsp;<em>here<\/em>.&#8221;<\/p>\n\n\n\n<p>The AI, acting as a Mermaid.js expert, reads the error, finds the mistake in your code\u2014that missing&nbsp;<code>end<\/code>, that unquoted string\u2014and simply fixes it for you. The parse error vanishes, and your diagram appears. It&#8217;s the &#8220;undo&#8221; button for your frustration.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. The &#8220;Make It Pretty&#8221; Button<\/h4>\n\n\n\n<p>Sometimes your diagram&nbsp;<em>works<\/em>, but it&#8217;s just plain ugly. You have long sentences that overlap, nodes are crammed together, and it\u2019s unreadable.<\/p>\n\n\n\n<p>This is where the&nbsp;<strong>&#8220;Improve with AI&#8221;<\/strong>&nbsp;button comes in.<\/p>\n\n\n\n<p>When you click this, you&#8217;re asking the AI to put on its &#8220;designer&#8221; 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 (<code>&lt;br&gt;<\/code>) to make them wrap nicely. It turns a messy, wide diagram into a clean, well-formatted, and professional-looking chart.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. The &#8220;Change Its Personality&#8221; Button<\/h4>\n\n\n\n<p>This one is the real game-changer.<\/p>\n\n\n\n<p>You&#8217;ve just finished a complex&nbsp;<code>flowchart<\/code>. It&#8217;s perfect. And then your manager asks, &#8220;This is great, but can I see this as a&nbsp;<em>sequence diagram<\/em>? I want to see the&nbsp;<em>order<\/em>&nbsp;of events.&#8221;<\/p>\n\n\n\n<p>In the past, this meant starting from scratch. A whole new file. A whole new syntax.<\/p>\n\n\n\n<p>With our tool, you just select &#8220;Sequence Diagram&#8221; from a dropdown menu and hit&nbsp;<strong>&#8220;Convert with AI.&#8221;<\/strong><\/p>\n\n\n\n<p>The AI doesn&#8217;t just look at the syntax. It reads and&nbsp;<em>understands the meaning<\/em>&nbsp;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&#8217;s like a universal translator for your ideas.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why This Matters<\/h3>\n\n\n\n<p>This isn&#8217;t just about making prettier diagrams. It&#8217;s about&nbsp;<strong>lowering the barrier to good design and documentation.<\/strong><\/p>\n\n\n\n<p>Tools like Mermaid are powerful, but their steep learning curve scares people away. Our project proves that AI can act as the ultimate &#8220;pair programmer&#8221; or &#8220;helpful assistant.&#8221; It bridges the gap between a human&#8217;s idea and the machine&#8217;s strict rules.<\/p>\n\n\n\n<p>By building AI&nbsp;<em>into<\/em>&nbsp;the workflow, we&#8217;ve turned a tool that was often frustrating into one that feels collaborative. It\u2019s a small step, but it\u2019s a peek into a future where our tools don&#8217;t just&nbsp;<em>tolerate<\/em>&nbsp;us\u2014they actively&nbsp;<em>help<\/em>&nbsp;us.<\/p>\n\n\n\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve all been there. You&#8217;re trying to map out a system, a user flow, or just a simple idea. You open a &#8220;Diagrams-as-Code&#8221; tool like Mermaid.js because you&#8217;re a developer, and that&#8217;s what you&#8217;re&nbsp;supposed&nbsp;to do. Ten minutes later, you&#8217;re staring at a &#8220;Parse Error&#8221; message, ready to throw your keyboard across the room. You missed [&hellip;]<\/p>\n","protected":false},"author":6946,"featured_media":8335,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[1285,111,110],"tags":[163,1300,1298],"class_list":["post-8340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-project","category-research","tag-development","tag-diagram","tag-mermaid"],"uagb_featured_image_src":{"full":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM.png",1429,862,false],"thumbnail":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM-150x150.png",150,150,true],"medium":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM-300x181.png",300,181,true],"medium_large":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM-768x463.png",640,386,true],"large":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM-1024x618.png",640,386,true],"1536x1536":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM.png",1429,862,false],"2048x2048":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM.png",1429,862,false],"slider-thumb":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM-542x352.png",542,352,true],"pop-thumb":["https:\/\/people.utm.my\/shahabuddin\/wp-content\/uploads\/sites\/890\/2025\/11\/Screenshot-2025-11-11-at-7.38.55-PM-542x340.png",542,340,true]},"uagb_author_info":{"display_name":"Dr. Shah","author_link":"https:\/\/people.utm.my\/shahabuddin\/?author=6946"},"uagb_comment_info":0,"uagb_excerpt":"We\u2019ve all been there. You&#8217;re trying to map out a system, a user flow, or just a simple idea. You open a &#8220;Diagrams-as-Code&#8221; tool like Mermaid.js because you&#8217;re a developer, and that&#8217;s what you&#8217;re&nbsp;supposed&nbsp;to do. Ten minutes later, you&#8217;re staring at a &#8220;Parse Error&#8221; message, ready to throw your keyboard across the room. You missed&hellip;","_links":{"self":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts\/8340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/users\/6946"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8340"}],"version-history":[{"count":2,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts\/8340\/revisions"}],"predecessor-version":[{"id":8343,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/posts\/8340\/revisions\/8343"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=\/wp\/v2\/media\/8335"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.utm.my\/shahabuddin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}