Mermaid for Business Analysts: Diagrams From Plain Text
Stop dragging boxes. Type a few lines in the free Mermaid live editor and watch a leave request process draw itself, with a start, a decision, labelled paths and two ends.
Step by step
Diagrams from text
- Type, don't drag. Process maps take a long time when you drag every box by hand. With Mermaid you type a few lines of text and the diagram draws itself. Here we build a leave request flow in about 2 minutes.
- mermaid.live. Open mermaid.live in your browser. It's free and needs no sign-up. You type the code on the left, and the drawing appears on the right.
Start the flow
- Diagram type. Clear the editor and type flowchart TD. TD means top down, so the process reads from top to bottom.
flowchart TD - First step. Square brackets inside round ones, like A([Leave requested]), make a rounded start shape. Square brackets alone make a box. The arrow is two dashes and a greater-than sign: -->. The drawing on the right now shows 2 shapes joined by an arrow. You didn't place anything. Mermaid did the layout.
A([Leave requested]) --> B[Check balance]
Decide
- Decision. Curly brackets make a decision diamond: B --> C{Enough days?}. Put each path's label between two pipe characters. C -->|Yes| goes to Send to manager, and C -->|No| goes to Reject request. The diamond splits the flow into 2 paths, labelled Yes and No.
B --> C{Enough days?} C -->|Yes| D[Send to manager] C -->|No| E[Reject request]
Finish
- The ends. Finish each path with a rounded end shape: D --> F([Leave booked]) and E --> G([Employee told]). That's 7 lines of text for one complete process: 1 start, 1 decision, and both paths reach an end.
D --> F([Leave booked]) E --> G([Employee told])
Why B As care
- Change in seconds. If the rule changes after the workshop, edit the words on the C{Enough days?} line and the drawing updates. You don't need to redraw any boxes. Because the diagram is just text, you can paste it into a ticket or a wiki page, and anyone can see exactly which words changed.
Recap
- The rules. The rules: start with flowchart and a direction. Write shape, arrow, shape. Use curly brackets for decisions and pipes for path labels, and let Mermaid do the layout.
Where your Mermaid diagram can live
Because a Mermaid diagram is just text, many tools turn it into a picture for you. GitHub and GitLab draw it in Markdown files, issues and wikis when you put the code in a block that starts with ```mermaid. Notion code blocks set to Mermaid and Obsidian notes draw it too. Azure DevOps wikis draw it as well, but there you start the code with graph TD instead of flowchart TD. So the diagram can sit right next to the user stories it explains.
Confluence and Jira don't draw Mermaid on their own at the time of writing, so teams there add a Marketplace app or paste in a picture. If your tool can't draw it, export a PNG or SVG from mermaid.live for the document and keep the text as the master copy, so the next change is still a 1-line edit.
What to learn after your first flowchart
This lesson covers one diagram type. A good order to learn the rest:
1. Decisions and Loops in a Mermaid Flowchart, for rework loops and more than 2 paths. 2. Swimlanes in Mermaid With Subgraphs, to show who does each step. 3. Mermaid Sequence Diagram for a Login Flow, for systems talking to each other. 4. Mermaid ER Diagram: Customers, Orders and Products, for data. 5. Mermaid State Diagram: Order Status Lifecycle, for statuses. 6. Mermaid Gantt Chart for a Project Plan, for timelines.
Mermaid Diagram Types Every BA Should Know shows them side by side, so you can pick the one your stakeholders need.
Highlight the step that changed
After a workshop, it helps to colour the one step people are discussing. Add a line at the end of the code like style C fill:#ffd6d6 and the Enough days? diamond turns light red. C is the node ID, and fill is the colour inside the shape.
To use the same colour on several shapes, define it once with classDef changed fill:#ffd6d6, then add :::changed after each node, like E[Reject request]:::changed. Use colour for meaning, such as changed steps or the reject path, and say what each colour means in a note under the diagram. The lesson BPMN-Style Process Map in Mermaid uses classDef to colour its start and end shapes.
Common mistakes
- Brackets in the wrong order for the start shape. A[(Leave requested)] draws a database cylinder. Put the round brackets on the outside and the square ones inside: A([Leave requested]).
- Brackets or symbols inside the label text. A label like Check balance (days) breaks the code, because Mermaid reads the brackets as a shape. Wrap the text in double quotes: B["Check balance (days)"].
- A node ID typed in a different case. IDs are case-sensitive, so c and C are 2 different nodes. A typo draws an extra box labelled c instead of joining the path to the Enough days? diamond.
- Using the word end in lower case as a node. end is a reserved word in Mermaid flowcharts, and a node called end breaks the diagram. Write End or END instead.
When a business analyst uses this
After a process workshop, a business analyst can write the agreed leave approval flow as Mermaid text and paste it into the requirements ticket. When a stakeholder changes a rule before sign-off, the analyst edits 1 line, and reviewers can see exactly which words changed instead of comparing 2 pictures.
Questions people ask
Is the Mermaid live editor free?
Yes. mermaid.live is free and works in the browser with no sign-up. You type code on the left and see the diagram on the right.
What does TD mean in a Mermaid flowchart?
TD means top down, so the flow reads from top to bottom. Use LR instead for a flow that reads from left to right.
How do I add a label to an arrow in Mermaid?
Put the label between two pipe characters right after the arrow, like C -->|Yes| D[Send to manager]. The word Yes then appears on that path.