Why mermaid diagrams will be the next big thing in creating diagrams?
Tags: diagrams, programming, documentation, mermaid
Published: 2024-01-27 18:28:03

We've all been there – grappling with traditional diagramming tools like draw.io and Lucidchart, feeling the burden of a steep learning curve and the anxiety of making edits post-export. The struggle is real, and it's a sentiment shared by many in the programming community. However, there's a rising star on the horizon – mermaid diagrams. In this blog post, we'll explore why mermaid diagrams are going to be the next big thing in creating diagrams, addressing the shortcomings of traditional tools and embracing the power of Language Model-based assistance.

## The Problems with Traditional Tools:

### Divergent Interfaces: 
The inherent diversity in the interfaces of tools like draw.io and Lucidchart often results in a high learning curve, making it a daunting task for users to navigate and utilize them effectively.

### Non-Incremental Nature: 
Traditional tools don't align with the programmer's mindset, lacking the ability to incrementally improve diagrams. The fear of committing to a final version before export can hinder the creative process.

### Overwhelming Features: 
These tools come loaded with features, many of which are often unnecessary for expressing fundamental concepts in diagrams. From intricate shapes to complex color palettes, the abundance of options adds unnecessary complexity.

### Version Control Woes: 
The absence of version control mechanisms leaves users scrambling to track changes, making collaboration on diagrams a challenge.

## The Mermaid Solution:
Enter mermaid – a game-changer in the world of diagramming. It addresses the pain points of traditional tools by conceptualizing diagrams through text, providing a simple and intuitive solution.

### Uniform Syntax: 
While learning the syntax for mermaid diagrams is a requirement, it offers a consistent and straightforward approach, reducing the initial learning curve.

### Dynamic Evolution: 
Mermaid embraces the programmer's desire for incremental development. Editing and refining diagrams become a breeze, aligning perfectly with the iterative nature of coding.

### Simplicity in Complexity: 
Mermaid strips away unnecessary complexity. It focuses on what's essential, eliminating the need for extensive grouping, ungrouping, and other superfluous features.

### Version Control: 
Unlike traditional tools, mermaid brings version control to the table, facilitating collaboration and allowing users to track changes seamlessly.

## The Challenge of Visualizing:
Creating diagrams using mermaid still requires you to learn the syntax and lookup the examples and sytax when you are creating your diagram.
One other problem with creating diagrams in general is that you have to visualize the whole diagram in your head before you can define it. That part is not easy for a complex document or concept. You know how something works and all the dots are connected in your head but putting it in a neat diagram is still hard.

## The Rise of Language Models:
Mermaid was already a breath of fresh air, but the emergence of Large Language Models (LLMs) has taken its capabilities to new heights.

### Overcoming Visualization Challenges: 
Creating diagrams often requires visualizing the entire structure beforehand, a daunting task for complex concepts. With LLMs like GPT-4, this hurdle becomes surmountable. Dump your knowledge in text format, and let the model generate the diagrams for you. This also makes iterating lot easiler.

This can be done with GPT-4 also but it has few issues

1. You have to copy paste the generated code into mermaid live editor after every new generation
2. GPT-4 also makes mistakes sometime like syntax errors, not escaping text correctly so you have to prompt it correctly.

## Automation with HueHive: 
Addressing challenges head-on, HueHive introduces a diagram generator that seamlessly integrates with mermaid. No more hassles of syntax errors or manual code pasting – just feed it text, and a perfect diagram is at your disposal. You can try it out [here](https://huehive.co/tools/diagrams)

## Conclusion:
I am solving these problems by creating diagram generator in HueHive. The detailed explaination of how it works in in [this](https://dev.to/kamalkishor1991/huehive-diagram-generator-mermaid-diagrams-using-chatgpt-3o12) blog but basically in most cases you can just give it text and follow up request to generate a perfact diagram without looking up mermaid syntax even once.

This is the percise reason why I think mermaid diagrams will be the next big thing. It was great before the rise of LLMs but with LLMs help it has become even more easy to create mermaid diagrams and this will continue to improve in future. I will continue to improve the results and experience in future but like any good tool the journey towards simplicity a collective effort!. Please share your throughts, ideas and issues in comments.