Mornox Tools

Mermaid Live Editor

Write Mermaid diagram syntax and see a live preview. Supports flowcharts, sequence diagrams, class diagrams, state diagrams, and more.

The Mermaid Live Editor is a powerful, web-based visualizer and development environment that allows users to create complex diagrams and charts using a simple text-based markup language. By translating code into scalable vector graphics in real-time, it fundamentally solves the problem of tedious, manual "pixel-pushing" associated with traditional drag-and-drop diagramming tools, enabling developers and professionals to version-control their visual documentation. This comprehensive guide will transform you from a complete novice into an expert practitioner, teaching you the underlying mechanics, syntax variations, best practices, and advanced configuration strategies required to master diagramming as code.

What It Is and Why It Matters

The Mermaid Live Editor is the official, browser-based graphical interface for Mermaid.js, an open-source JavaScript library that renders Markdown-inspired text definitions into dynamic diagrams and charts. In traditional workflow environments, creating a flowchart or system architecture diagram requires specialized software like Microsoft Visio or Lucidchart, where users must manually drag shapes onto a canvas, align them perfectly, and draw connecting lines. This manual approach is fraught with inefficiencies: it is time-consuming, difficult to update, nearly impossible to track in version control systems like Git, and prone to formatting errors when shared across different operating systems. The Mermaid Live Editor eliminates these bottlenecks by introducing the paradigm of "Diagramming as Code" (DaC). Instead of drawing a rectangle and typing inside it, a user simply types A[Login Screen] into the editor, and the underlying engine instantly generates a perfectly formatted rectangular node containing that text.

Understanding why this matters requires looking at the modern software development and documentation lifecycle. Modern organizations rely heavily on continuous integration, agile methodologies, and rapid iteration, meaning that system architectures and business logic change daily. When documentation relies on static images generated by drag-and-drop tools, the diagrams inevitably become outdated because updating them is too much of a hassle. With Mermaid, the diagram is just text. It can be stored directly inside a project's README.md file, updated with a simple text commit, and reviewed in a pull request exactly like application code. The Live Editor serves as the crucial bridge in this ecosystem. It provides a split-screen interface where users can write their Mermaid syntax on the left and instantly see the rendered diagram on the right. This immediate visual feedback loop is essential for learning the syntax, debugging complex layouts, and fine-tuning the visual output before exporting the final image or copying the code into a permanent documentation repository. For anyone involved in technical writing, software engineering, project management, or business analysis, mastering the Mermaid Live Editor is a mandatory step toward creating sustainable, maintainable, and professional visual documentation.

History and Origin of Mermaid and the Live Editor

To fully grasp the significance of the Mermaid Live Editor, one must understand the origins of the Mermaid.js library itself. The project was created in 2014 by Knut Sveidqvist, a Swedish software architect who grew deeply frustrated with the friction of updating project documentation. Sveidqvist noticed that while Markdown had successfully revolutionized how developers wrote formatted text by stripping away complex formatting menus, there was no equivalent for diagrams. Developers were forced to leave their text editors, open heavy graphical applications, export PNG files, and link them back into their Markdown documents. To solve this, Sveidqvist developed Mermaid.js, utilizing the D3.js rendering library and the Jison parser generator to translate simple text strings into Scalable Vector Graphics (SVG). The initial release supported only basic flowcharts and sequence diagrams, but the open-source community quickly recognized the immense value of the tool, leading to rapid adoption and contribution.

As Mermaid.js grew in complexity and capability, a new problem emerged: users found it difficult to write diagram syntax blindly without a way to test it. Embedding a broken Mermaid script into a webpage would simply result in a blank space or an unhelpful syntax error. To solve this, the Mermaid core team and community contributors developed the Mermaid Live Editor. Initially hosted on GitHub Pages as a rudimentary split-screen HTML file, the Live Editor evolved into a sophisticated, React-based web application. A massive turning point in the history of the ecosystem occurred in February 2022, when GitHub officially announced native support for Mermaid.js within all of its Markdown files. This meant that millions of developers could suddenly render diagrams directly in their repositories, issues, and pull requests. Almost overnight, the Mermaid Live Editor transitioned from a niche developer utility to an essential daily tool used by millions to draft, test, and share diagrams before committing them to enterprise repositories. Today, the Live Editor is maintained by a dedicated group of open-source contributors, featuring advanced capabilities like JSON-based theme configuration, automated URL state encoding, and high-resolution graphical exports, cementing its place as the premier testing ground for Diagramming as Code.

How It Works — Step by Step Mechanics

The Mermaid Live Editor operates through a fascinating, multi-step pipeline that runs entirely within the user's web browser, requiring no server-side processing to generate the images. When you open the Live Editor, you are presented with three primary panels: the Code panel (where you write the text), the Config panel (where you define JSON styling rules), and the Preview panel (where the diagram appears). The moment you type a character into the Code panel, a complex chain of events is triggered. First, the text is passed into a Lexical Analyzer (Lexer). The Lexer reads your raw text and breaks it down into "tokens"—identifying which parts of your text represent nodes, which parts represent connecting arrows, and which parts represent labels. For example, if you type A --> B, the Lexer identifies A as an entity, --> as a directional link token, and B as another entity.

Once the tokens are identified, they are passed to the Parser, which is built using Jison (a JavaScript parser generator). The Parser applies a strict set of grammar rules based on the specific type of diagram you are creating (e.g., a flowchart requires different grammar than a Gantt chart). If you violate the grammar—such as typing an unsupported arrow type like ->->—the Parser throws a syntax error, which the Live Editor immediately catches and displays as a red warning box over the Preview panel. If the syntax is valid, the Parser generates an Abstract Syntax Tree (AST), which is a structured data representation of your diagram's logic. This AST is then handed off to the rendering engine, which utilizes D3.js and Dagre (a directed graph layout engine). The layout engine performs complex mathematical calculations to determine the optimal X and Y coordinates for every shape, ensuring that lines cross as infrequently as possible and that the spacing is uniform. Finally, the engine generates raw SVG (Scalable Vector Graphics) code and injects it into the DOM (Document Object Model) of the Preview panel, rendering the visual diagram.

A unique and critical feature of the Live Editor's mechanics is its state management system. As you type, the Live Editor continuously takes your code, your JSON configuration, and your UI preferences, compresses them, and encodes them into a Base64 string. This string is then appended to the browser's URL. For example, a simple diagram might generate a URL ending in #pako:eNptkMtqwzAQRX9FzCqF.... This means the entire state of your diagram is stored in the web link itself. You can copy this URL and send it to a colleague on the other side of the world; when they click it, their browser decodes the Base64 string, populates their local Live Editor, and renders the exact same diagram, all without a single byte of data being saved to a central database.

Key Concepts and Terminology

To utilize the Mermaid Live Editor effectively, you must become fluent in the specific terminology that governs Diagramming as Code. The foundational building block of most Mermaid diagrams is the Node. A node represents an entity, a step, or a concept within your diagram. In the syntax id1[User Login], id1 is the node's unique identifier (used by the rendering engine to track it), while [User Login] dictates both the shape of the node (brackets indicate a rectangle) and the text displayed inside it. The connections between these nodes are called Edges or Links. Edges define the relationship and directionality between nodes. For instance, --> creates a solid arrow pointing right, while -.-> creates a dotted arrow, and === creates a thick, non-directional line. Understanding how to manipulate edges is crucial for directing the viewer's eye through the logical flow of the diagram.

Another critical concept is the Directive, which is an instruction passed directly to the Mermaid rendering engine to alter its default behavior before the diagram is drawn. Directives are wrapped in double percent signs, such as %%{init: {'theme': 'dark'}}%%. These allow you to override global settings on a per-diagram basis. Within the Live Editor, you will also frequently interact with the Config JSON panel. While directives are written inline with the code, the Config JSON panel allows you to pass a structured JavaScript Object Notation payload to the engine. This is where you define precise visual parameters, such as changing the primary color of all nodes to #ff0000 (red) or adjusting the exact pixel width of the lines.

You must also understand Subgraphs. A subgraph is a visual grouping mechanism that draws a bounding box around a specific set of nodes, effectively creating a diagram within a diagram. This is essential for representing complex systems, such as grouping three different server nodes inside a subgraph labeled "AWS Cloud". Finally, you will encounter the concept of Serialization. In the context of the Live Editor, serialization refers to the process of converting your diagram code and configuration into the shareable Base64 URL mentioned earlier. Understanding these terms—Nodes, Edges, Directives, Config JSON, Subgraphs, and Serialization—provides the necessary vocabulary to debug issues, read official documentation, and communicate effectively with other developers about your visual architecture.

Types of Diagrams and Supported Syntaxes

The Mermaid Live Editor is not limited to a single type of visualization; it is a multi-disciplinary tool that supports over a dozen distinct diagram types, each with its own specialized syntax and layout engine. The most ubiquitous type is the Flowchart. Flowcharts are used to map out algorithms, decision trees, and process workflows. A flowchart must begin with a direction declaration, such as graph TD (Top to Down) or graph LR (Left to Right). Nodes in flowcharts can take many shapes depending on the wrapping characters: (Text) creates rounded corners, {Text} creates a diamond (typically used for decisions), and [(Text)] creates a cylinder (universally recognized as a database). A simple flowchart looks like this:

graph TD
    A[Start] --> B{Is it raining?}
    B -- Yes --> C[Take Umbrella]
    B -- No --> D[Wear Sunglasses]
    C --> E[Leave House]
    D --> E

The second most popular type is the Sequence Diagram, which is indispensable for software engineers mapping out API calls or microservice interactions. Sequence diagrams focus on the chronological exchange of messages between different actors or systems. They begin with the keyword sequenceDiagram. Actors are defined automatically when they are involved in a message, using arrows like ->> (solid line with arrow) for synchronous requests, or -->> (dotted line with arrow) for asynchronous responses. You can also add activate and deactivate commands to show when a specific service is actively processing a request.

Gantt Charts are a project management staple supported natively by Mermaid. They allow users to visualize project schedules, dependencies, and timelines. A Gantt chart begins with the gantt keyword, followed by a title, date formats, and specific tasks grouped into sections. You define a task by giving it a name, an ID, a start date, and a duration (e.g., Design Phase :des1, 2023-10-01, 5d). The engine automatically calculates the layout on a horizontal time axis.

For database administrators and system architects, Entity-Relationship (ER) Diagrams are crucial. ER diagrams map out database tables and the relationships between them (one-to-one, one-to-many, many-to-many). They start with erDiagram. Tables are defined by their names, and relationships are drawn using specialized crow's foot notation syntax, such as CUSTOMER ||--o{ ORDER : places, which reads as "A customer places zero or more orders." The Live Editor also supports Class Diagrams (for object-oriented programming), State Diagrams (for finite state machines), Pie Charts, User Journey Maps, Gitgraphs (for visualizing branching strategies), and Mindmaps. Each diagram type utilizes a distinct parser within the Live Editor, meaning the syntax rules do not cross over; you cannot use a Sequence Diagram arrow (->>) inside a Flowchart.

Real-World Examples and Applications

To truly master the Mermaid Live Editor, you must understand how it is applied to solve tangible, real-world business and engineering problems. Let us examine three concrete scenarios with realistic numbers and parameters.

Scenario 1: E-Commerce Checkout Architecture (Sequence Diagram) Imagine a software architect designing a checkout flow for an e-commerce platform that processes $50,000 in daily transactions. The system involves a Web Frontend, a Payment Gateway, and an Inventory Database. The architect needs to document how these systems interact to prevent race conditions where an item is sold twice. Using the Live Editor, they write a Sequence Diagram:

sequenceDiagram
    participant Web as Frontend
    participant Pay as Stripe Gateway
    participant DB as Inventory DB
    Web->>DB: Check stock availability (Item #4599)
    DB-->>Web: Stock OK (Quantity: 3)
    Web->>Pay: Process $149.99 charge
    activate Pay
    Pay-->>Web: Payment Success (TxID: 88A92)
    deactivate Pay
    Web->>DB: Deduct 1 from stock
    DB-->>Web: Stock updated (Quantity: 2)

This diagram provides a mathematically precise, chronological map of the transaction. If a new engineer joins the team, they can read this diagram and immediately understand the required API sequence without reading thousands of lines of source code.

Scenario 2: Startup Database Schema (Entity-Relationship Diagram) A data engineer at a SaaS startup needs to design a relational database for a new user management system anticipating 10,000 active users. They need to visualize the relationship between Users, Subscriptions, and Invoices. Instead of using a clunky GUI, they use the Live Editor:

erDiagram
    USER ||--o{ SUBSCRIPTION : holds
    USER ||--o{ INVOICE : receives
    USER {
        int id PK
        string email
        string password_hash
    }
    SUBSCRIPTION {
        int sub_id PK
        int user_id FK
        string plan_tier
        float monthly_cost
    }

By defining the Primary Keys (PK) and Foreign Keys (FK) directly in the text, the engineer creates a schema that can be copied directly into the company's technical wiki. When the company decides to add a new "Organizations" table six months later, updating the diagram takes exactly three lines of text rather than an hour of manual graphic design.

Scenario 3: Software Release Timeline (Gantt Chart) A project manager is overseeing a 4-week sprint to release a new mobile application feature. They need to communicate the schedule to a team of 15 developers and stakeholders. They use the Live Editor to generate a Gantt chart:

gantt
    title Mobile App Feature Release Q3
    dateFormat  YYYY-MM-DD
    section Backend
    API Development       :a1, 2023-09-01, 7d
    Database Migration    :a2, after a1, 3d
    section Frontend
    UI Implementation     :b1, 2023-09-05, 10d
    Integration Testing   :b2, after a2, 5d

The engine automatically calculates that the Integration Testing cannot start until the Database Migration is finished, visually staggering the bars on the timeline. If the API Development takes 9 days instead of 7, the manager simply changes 7d to 9d, and the entire chart recalculates and shifts automatically, saving countless hours of manual adjustment.

Common Mistakes and Misconceptions

Despite its logical foundation, beginners frequently fall into specific traps when learning the Mermaid Live Editor. The most pervasive mistake is Syntax Fragility caused by special characters. Because Mermaid relies on strict parsing rules, using reserved characters (like brackets, parentheses, or semicolons) inside a node's text label without properly escaping them will instantly break the parser. For example, typing A[User (Admin)] will result in a syntax error because the parser gets confused by the nested parentheses inside the brackets. The correct approach, which beginners often miss, is to wrap complex strings in double quotation marks: A["User (Admin)"]. This tells the parser to treat everything inside the quotes as a literal string, ignoring any reserved characters.

Another major misconception is the illusion of absolute positioning. Users transitioning from tools like Visio often become frustrated because they cannot force a specific box to sit exactly 50 pixels to the left of another box. They try to add invisible nodes or hack the layout engine to force a specific visual arrangement. This is a fundamental misunderstanding of Diagramming as Code. Mermaid uses a directed graph layout algorithm (Dagre) that mathematically calculates the most efficient layout based on the connections. The user's job is to define the logic and the relationships; the engine's job is to define the pixels. Fighting the layout engine is a guaranteed path to frustration. If a diagram looks messy, the solution is not to force the layout, but to simplify the logic, group items into subgraphs, or break the massive diagram into two smaller ones.

A third common pitfall is ignoring the URL state limits. Because the Live Editor encodes the entire diagram state into the URL via Base64, massive diagrams can generate URLs that exceed the maximum character limit enforced by some web browsers or chat applications (typically around 2,048 characters). A beginner might spend three hours writing a 500-line architecture diagram, copy the URL, paste it into Slack, and find that the link is truncated and broken. To prevent this, users working on massive diagrams should regularly save their raw text locally, or utilize the "Save to Gist" feature built into the Live Editor, which uploads the code to GitHub and generates a short, stable link rather than relying on URL encoding.

Best Practices and Expert Strategies

To elevate your use of the Mermaid Live Editor from functional to professional, you must adopt the mental models and strategies used by expert technical writers. The first rule of expert diagramming is Modular Modesty. A single diagram should convey a single, unified concept. A common anti-pattern is attempting to map an entire enterprise architecture in one massive flowchart containing 150 nodes. Not only will the layout engine struggle to render this cleanly (resulting in a spiderweb of crossing lines), but the human brain cannot parse it. Experts keep their diagrams under 40-50 nodes. If a system is larger than that, they use a top-level diagram to show the macro-architecture, and then create separate, detailed diagrams for each specific subsystem.

Semantic Directionality is another critical strategy. When defining a flowchart, you must choose a direction: Top-Down (TD) or Left-Right (LR). Experts do not choose this arbitrarily. Top-Down layouts are best suited for hierarchical data, organizational charts, or rigid step-by-step algorithms where gravity implies progression. Left-Right layouts are vastly superior for process pipelines, data transformations, or user journeys, as they align with the natural reading direction of Western languages. Furthermore, experts strictly organize their code blocks. Rather than defining nodes and connections randomly as they think of them, professionals separate their definitions from their relationships. An expert's code looks like this:

graph LR
    %% Node Definitions
    A[Client Browser]
    B[Load Balancer]
    C[Web Server]
    D[(Database)]

    %% Relationships
    A --> B
    B --> C
    C --> D

By defining all the nodes at the top and all the relationships at the bottom, the code remains highly readable and maintainable, making it much easier to update or debug six months later.

Finally, experts leverage Custom Styling and Theming to convey meaning, not just aesthetics. Using the Config JSON panel in the Live Editor, you can assign specific CSS classes to specific nodes. If you are mapping a network architecture, you should color-code the nodes based on their security zones: green for public-facing, yellow for internal, and red for restricted databases. By applying a class like classDef secure fill:#ffcccc,stroke:#ff0000; and attaching it to your database nodes, you instantly communicate critical security boundaries to the viewer without requiring them to read a single word of text.

Edge Cases, Limitations, and Pitfalls

While the Mermaid Live Editor is a revolutionary tool, it is not a magical panacea, and relying on it blindly without understanding its limitations can lead to project delays. The most significant edge case involves Layout Engine Crossing Paradoxes. Because Mermaid uses an automated layout algorithm, it attempts to minimize the number of times lines cross each other. However, in highly interconnected, non-hierarchical systems (such as a peer-to-peer network or a microservices mesh where every service talks to every other service), the math breaks down. The algorithm will eventually produce a diagram that looks like a tangled ball of yarn, with lines cutting directly through the text of other nodes, rendering the diagram entirely illegible. When you hit this mathematical limitation, Mermaid offers no manual override to "drag" the line out of the way. Your only recourse is to fundamentally redesign the diagram or switch back to a manual drawing tool.

Another significant pitfall is Browser Resource Exhaustion. The Live Editor runs entirely on the client side, utilizing your computer's CPU and RAM to parse the text and render the SVG via D3.js. If you attempt to render an Entity-Relationship diagram with 200 tables and 500 complex relationships, the browser tab will likely freeze, consume gigabytes of memory, and eventually crash with an "Out of Memory" error. The Live Editor is optimized for standard documentation sizes, not for visualizing big data or auto-generating schemas from massive legacy enterprise databases.

Furthermore, there are strict limitations regarding Accessibility and Responsive Design. The output of the Mermaid Live Editor is a static SVG image. While SVGs scale perfectly without pixelation, they do not automatically re-flow their text or layout on small screens. If you generate a wide Left-Right flowchart that is 1,200 pixels wide and embed it in a mobile-friendly documentation site, the diagram will shrink to fit the 300-pixel width of a smartphone screen, making the text microscopically small and completely unreadable. Unlike standard HTML text, Mermaid diagrams are not responsive. Additionally, the text rendered inside the SVG is not always easily readable by screen readers used by visually impaired users, meaning you must always provide a thorough text-based alternative (alt-text) when exporting and publishing these diagrams to ensure compliance with web accessibility standards (WCAG).

Industry Standards and Benchmarks in Diagramming-as-Code

The adoption of Mermaid and its Live Editor is not just a passing trend; it has established new benchmarks and standards across the software engineering industry. The most critical benchmark is the C4 Model for Visualizing Software Architecture. Created by Simon Brown, the C4 model dictates that software should be documented in four hierarchical levels: Context, Containers, Components, and Code. The industry standard has rapidly shifted toward using Mermaid to execute the C4 model. Organizations expect developers to provide a Context diagram (using a Mermaid flowchart) in the root README.md of a repository, and detailed Component diagrams (using Mermaid sequence diagrams) in the specific sub-folders of the codebase. The Live Editor is the standardized testing ground where these C4 diagrams are drafted and reviewed before being merged into production documentation.

Another industry standard is the Integration into CI/CD (Continuous Integration / Continuous Deployment) Pipelines. In mature engineering organizations, documentation is treated with the same rigor as application code. A benchmark for a "good" documentation pipeline is the ability to auto-generate and validate diagrams during the build process. Because Mermaid is text-based, companies use automated linters to scan pull requests. If an engineer modifies a database schema in the SQL code but fails to update the corresponding Mermaid ER diagram text, the CI pipeline will flag the discrepancy and block the deployment. The Live Editor serves as the manual interface for this automated ecosystem, allowing engineers to quickly paste in the failing code, identify the syntax error visually, fix it, and push the corrected text back to the repository.

Finally, the benchmark for widespread adoption was solidified by the Markdown standardization. Platforms like GitHub, GitLab, Atlassian (Jira/Confluence), and Notion have all adopted the exact same triple-backtick syntax for rendering Mermaid. By standardizing on ```mermaid as the universal code block identifier, the industry has ensured that a diagram written and tested in the Mermaid Live Editor today will render identically across all major project management and version control platforms for the next decade. This cross-platform standardization is a rare achievement in the tech industry and highlights why learning this specific syntax is a high-leverage investment for any technical professional.

Comparisons with Alternatives

To fully appreciate the Mermaid Live Editor, one must compare it objectively against its primary alternatives in the market, understanding the honest trade-offs of each approach.

Mermaid Live Editor vs. WYSIWYG Tools (Visio, Lucidchart, Draw.io) Tools like Microsoft Visio or Lucidchart operate on a "What You See Is What You Get" (WYSIWYG) paradigm. You manually drag shapes onto a grid.

  • Pros of Visio/Lucidchart: Ultimate control over aesthetics. If you want a box to be exactly 12 pixels to the right, you can move it there. They offer massive libraries of highly specific icons (e.g., specific Cisco router models). They are generally easier for non-technical business users to pick up immediately.
  • Cons of Visio/Lucidchart: They are terrible for version control. You cannot easily see "what changed" between two versions of a Visio file in a Git repository. They are slow to update; adding a step in the middle of a flowchart requires manually moving all subsequent boxes to make room.
  • When to use Mermaid: When version control, speed of updates, and standardizing documentation in Markdown are your top priorities.

Mermaid Live Editor vs. PlantUML PlantUML is the oldest and most direct competitor to Mermaid in the Diagramming-as-Code space. It uses a very similar text-to-image philosophy.

  • Pros of PlantUML: It is incredibly mature and supports highly complex, massive diagrams that might crash Mermaid. It has deeper support for strict UML (Unified Modeling Language) standards.
  • Cons of PlantUML: It runs on Java. To use PlantUML locally, you must install the Java Runtime Environment and Graphviz, which is a massive barrier to entry. Its syntax is older and arguably more clunky.
  • When to use Mermaid: Mermaid is vastly superior for modern web integration. Because Mermaid is built on JavaScript, it runs natively in the browser without any backend server or Java installation required. This is why GitHub chose Mermaid over PlantUML for native integration.

Mermaid Live Editor vs. Graphviz (DOT language) Graphviz is a 30-year-old open-source graph visualization software that uses the DOT language.

  • Pros of Graphviz: It possesses the most powerful and mathematically advanced layout algorithms in the world for handling massive, highly complex network graphs with thousands of nodes.
  • Cons of Graphviz: It is strictly for network graphs and flowcharts; it cannot do sequence diagrams, Gantt charts, or pie charts natively. The DOT syntax is highly technical and less intuitive for beginners.
  • When to use Mermaid: For 95% of standard business and software documentation, Mermaid is more versatile, easier to read, and offers a much friendlier Live Editor experience. Graphviz should be reserved for data scientists visualizing massive datasets.

Frequently Asked Questions

Is the Mermaid Live Editor truly free, and is my data secure when I use it? Yes, the Mermaid Live Editor is 100% free and open-source. Regarding data security, the tool operates entirely client-side within your web browser. When you type code into the editor, it is not being sent to a remote server to be processed or saved into a database. The rendering happens using your local machine's resources, and the "save" state is simply encoded into the URL on your screen. However, if you use the specific "Save to Gist" feature, your code will be uploaded to GitHub's public or secret Gist servers, so you should ensure you are logged into a secure GitHub account if handling proprietary architecture.

Can I export the diagrams I make in the Live Editor to use in Word or PowerPoint? Absolutely. The Live Editor provides multiple export options located in the Actions menu. You can export your diagram as a high-resolution PNG image, which can be pasted directly into Microsoft Word, PowerPoint, or Google Docs. More importantly, you can export the diagram as an SVG (Scalable Vector Graphic). SVGs are highly recommended for professional presentations because they will never pixelate or become blurry, regardless of how large you stretch them on a presentation slide.

Why is my flowchart rendering from top to bottom when I want it to go left to right? This is controlled by the direction declaration in the very first line of your code. If your code starts with graph TD or flowchart TD, the engine reads "Top Down" and forces a vertical layout. To change this to a horizontal layout, simply change the first line to graph LR (Left to Right). You can also use RL (Right to Left) or BT (Bottom to Top) depending on your specific visual requirements.

How do I add a hyperlink to a node so users can click it? Mermaid supports interactive elements like hyperlinks, which is a massive advantage over static image tools. To add a link, you first define your node, and then use the click command followed by the node ID and the URL in double quotes. For example: A[Visit Google]; click A "https://www.google.com". When exported as an SVG or rendered in a supported Markdown environment, clicking the node will redirect the user to the specified web page.

Why does the Live Editor say "Syntax Error" when I try to use parentheses in my node text? Parentheses, brackets, and semicolons are reserved characters in the Mermaid parser used to define the shape of nodes. If you type A[Step 1 (Testing)], the parser thinks you are trying to open a new shape definition inside an existing one, causing a crash. To fix this, you must escape the text by wrapping the entire label in double quotation marks. The correct syntax is A["Step 1 (Testing)"]. This tells the parser to treat the parentheses as plain text.

Can I use custom brand colors for my company in the Live Editor? Yes, you can heavily customize the colors to match your corporate branding using Mermaid's theming engine. You can do this inline using directives. By adding %%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000', 'lineColor': '#0000ff'}}}%% to the very top of your code, you override the default colors. You can use standard hex codes to match your company's exact brand guidelines, ensuring your diagrams look professional and cohesive in official reports.

Command Palette

Search for a command to run...