Diagrams guide

How to make a flowchart by typing Mermaid text

Write a header line, then one arrow per line with each step in brackets. A worked flowchart, line by line, with branches, shapes and the typing slips to avoid.

Diagrams · · 6 minute read

The short answer

  • Begin with "flowchart TD" for top to bottom, or "flowchart LR" for left to right.
  • Give each step a short code once, with its words, then reuse the code alone.
  • Label both arrows out of every decision, so nobody guesses which way is yes.

A finished example

This is what the Flowchart template can look like once it is filled in. This one is for a small shop handling an online order.

An example made up for this guide. Your own board starts with the headings and prompts, and you add the notes.
Read the example as words
The board
Order arrives
Check the stock
In stock?
Pack and post
Order more
Tell the customer
How the boxes are joined
Order arrives leads to Check the stock
Check the stock leads to In stock?
In stock?, Yes, leads to Pack and post
In stock?, No, leads to Order more
Order more leads to Check the stock
Pack and post leads to Tell the customer

A Mermaid flowchart is a list of arrows

To make a flowchart by typing, write a header line, then one line for each arrow between two steps. Mermaid, a plain text format for diagrams, turns those lines into boxes and arrows.

This guide is for anyone who has to draw a process and would rather type than drag. It goes through one flowchart a line at a time, so you can copy the patterns into your own.

You need only a few patterns. A step in square brackets is a box. A step in curly brackets is a diamond, for a question. Two dashes and a greater-than sign make an arrow. Words between two upright bars on an arrow become its label.

Each step gets a short code, such as A or check. The first time you use the code, you add the words. After that, the code alone is enough. That is what lets one step have several arrows in and out.

On doodleboard, you type the text into Diagram from text, in the insert menu, on every plan including Free. The board draws it as shapes and connectors you can then move and restyle.

Write the text in this order

Writing in a set order stops most mistakes before they happen. Allow fifteen minutes for a chart of ten steps.

  • Write the header line: flowchart TD. Use LR instead when the chart is long and the screen is wide.
  • Write the main path first, from start to finish, ignoring branches. One arrow per line.
  • Mark the start and end with rounded ends, using round brackets inside square ones, such as A([Order arrives]).
  • Turn each question into a diamond with curly brackets, such as C{Date free}.
  • Add the second way out of each diamond, with labels: C -->|No| X[Offer another date].
  • Use a dotted arrow, written -.->, for a step that only sometimes happens.
  • Read the text aloud as sentences. "If the date is free, then take a deposit." Anything that sounds wrong is wrong.
  • On doodleboard, choose More, then Diagram from text (Mermaid). Clear the sample, paste your text and select Add to the board.

If the board cannot read a line, it says so beside the box and keeps your text, so nothing is lost. Fix the line and try again.

Prefer to sketch the shape before typing? The Flowchart template has a start, steps and a decision ready to fill, under More, then Template.

A home bakery's cake orders, line by line

Take a home baker who sells celebration cakes, as an example. Orders came by message and she kept forgetting to ask for allergy details. She typed her process as eleven lines.

  • flowchart TD tells the board to draw from top to bottom.
  • A([Order request]) --> B{Date free} starts with a rounded box and asks the first question.
  • B -->|No| C[Offer the next free date] handles the busy weeks.
  • C --> B sends the customer back to the question with a new date.
  • B -->|Yes| D[Ask about allergies] is the step she kept missing, now in the main path.
  • D --> E{Nuts or gluten}
  • E -->|Yes| F[Send the allergy form]
  • E -->|No| G[Take a deposit]
  • F --> G joins the two paths again.
  • G --> H[Bake and decorate] --> I([Collection]) chains two arrows on one line.
  • G -.-> J[Send a reminder two days before] is dotted, because some customers do not need it.

The board drew ten shapes in rows, with the loop from C back to B shown as a returning arrow. She coloured the allergy step red, framed the chart and kept the text in a doc beside it. When she added a delivery option a month later, she changed two lines and drew it again.

Typing slips the box catches, and ones it misses

Some mistakes stop the chart being drawn. The box on doodleboard names those for you. Others draw a chart that looks fine but is wrong.

Slips the box catches:

  • No header line. The text must start with flowchart or graph. Add it and try again.
  • No steps at all, such as a header with nothing under it.

Slips that draw the wrong chart:

  • A space inside a code. Write order_check or orderCheck, never order check, or the words split in odd ways.
  • Brackets inside the words. A step like A[Check (by hand)] confuses the shape. Wrap the words in double quotes instead: A["Check (by hand)"].
  • Two steps sharing a code. The board draws them as one box, with every arrow meeting there.
  • A decision with only one labelled arrow. The chart draws, but readers cannot tell what the other way means.

Two habits catch most of these. Keep a list of your codes at the top of the doc, with what each one stands for. Then, after drawing, follow every arrow out of every diamond with your finger. If you cannot say where it goes, the text is not finished.

Why a typed chart is easier to keep up to date

Charts drawn by hand tend to freeze. Moving one step means shifting a dozen boxes, so people stop making changes. Typed charts stay cheap to change.

On doodleboard, a typed chart becomes ordinary shapes and connectors. Connectors stay joined when you move a box, so small fixes on the board are quick. For bigger changes, edit the text in the doc, draw again and delete the old version.

Keeping the text on the same board helps a second person. They can read the logic in the doc without decoding arrows, and spot a missing branch. They can pin a comment on the line that looks wrong, and you reply under it. Comments are on every plan.

Changes reach everyone on the board as they happen, so people looking on a call see the new version at once. On Free and Solo, only you edit and others look. On Team, anyone with a seat can edit the text and redraw.

When the chart is final, export the board as a picture or a PDF to put in a handbook. If you are on Solo or Team, board history lets you go back to an earlier version.

Questions people ask

What is the difference between flowchart TD and flowchart LR?

TD draws from top to bottom, which suits charts read on a phone. LR draws from left to right, which suits wide screens and long processes. BT and RL draw the other way round.

How do I put a line break inside a step?

Write <br> where you want the break, inside the brackets. Use it for long step names, so boxes stay a sensible width. Keep most steps to five words or fewer anyway.

Can I group steps into boxes or lanes with Mermaid on doodleboard?

The board skips group lines such as subgraph, and still draws the steps inside them. To show lanes, draw frames around the steps after the chart is on the board, one frame per person or team.

Which shapes can I use in a typed flowchart?

Square brackets give a box, round brackets a rounded box and curly brackets a diamond. Double round brackets give a circle, and round brackets inside square ones give a pill shape for start and end.

Features: More than sticky notes

Put it on a shared whiteboard

Start for free with one board and up to three people, or try every feature for 7 days.

Start for freeSee pricing