RichMarkdown › Mermaid diagrams in Markdown

Mermaid diagrams in Markdown

Updated

Mermaid turns a few lines of text into a diagram. You write the text in a code block marked mermaid, and apps that support it draw the picture. Because the source is text, the diagram lives in the same file as your notes and changes show up in version control.

In short

A first diagram

```mermaid
flowchart TD
  A[Draft] --> B{Reviewed?}
  B -- Yes --> C[Publish]
  B -- No --> A
```

flowchart TD means a flowchart drawn top-down; LR draws it left to right. Square brackets make a box, curly brackets a decision, and --> an arrow. Text between two dashes labels the arrow.

The diagram types people use most

Sequence diagram

```mermaid
sequenceDiagram
  Browser->>Server: Sign in
  Server-->>Browser: Session cookie
  Browser->>Server: Save notes
```

Gantt chart

```mermaid
gantt
  dateFormat YYYY-MM-DD
  section Launch
  Write copy   :a1, 2026-01-05, 5d
  Design       :a2, after a1, 4d
  Review       :after a2, 2d
```

Pie chart

```mermaid
pie title Where the time goes
  "Writing" : 55
  "Editing" : 30
  "Formatting" : 15
```

Mermaid also has class diagrams, state diagrams, entity-relationship diagrams, mind maps and timelines. The syntax for each is in the Mermaid documentation.

Writing diagrams in RichMarkdown

  1. Open the editor. On an empty line, type ```mermaid and press Enter. This starts a code block marked as Mermaid.
  2. Or paste or open Markdown that already has a mermaid block.
  3. Write the diagram. It is drawn under the code a moment after you stop typing.
  4. If the text has a mistake, the error message is shown in place of the picture, and the code stays as you wrote it.

The diagram library is loaded only for notes that contain a diagram, and it runs in your browser. The diagram text is not sent anywhere.

Where the diagram goes next

DestinationWhat arrives
Export .mdThe mermaid code block, unchanged.
Download Word (.docx) and Copy for WordThe drawn diagram as a picture. It cannot be edited in Word; keep the Markdown as the source.
Save as PDF / printThe drawn diagram, without the code.
A shared linkThe drawn diagram.
GitHub, GitLab, ObsidianThey draw mermaid blocks themselves.
Apps without MermaidThe text is shown as a code block.

Common mistakes

Related guides

FAQ

Do I need to install anything?

No. The diagram is drawn in your browser.

Is my diagram uploaded?

No. The drawing happens on your device. Nothing is sent unless you share the note as a link or turn on cloud save.

Can I edit the diagram in Word?

No. Word receives a picture. Change the Mermaid text here and export again.

Does GitHub show Mermaid diagrams?

Yes. GitHub draws mermaid code blocks in README files, issues and comments.

Why is my diagram shown as code?

The code block is not marked as mermaid, or the app that displays it does not support Mermaid.

Open the free editor