Mermaid Diagrams

NocoDocs renders Mermaid diagrams directly in code blocks. Write the diagram as text, and NocoDocs draws the SVG. Supported diagrams include flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, user journeys, and more.

Flowchart example rendered in NocoDocs

Insert a Mermaid Diagram

  1. Insert a code block (type /code or ```).
  2. In the top-right of the code block, click the language selector.
  3. Select Mermaid.
  4. Type or paste your Mermaid source. The diagram renders while you type.

Selecting Mermaid from the code block language list

View Modes

When the language of the block is Mermaid, a view-mode picker shows in the toolbar. Open it to change between the three modes:

View-mode picker with Show code, Split view, and Show diagram options

Show code

Shows the source only. Use it while you edit.

Mermaid block in Show code mode

Split view

Shows the source on top and the rendered diagram below. You can edit and preview in the same block.

Mermaid block in Split view mode with code above and diagram below

Show diagram

Shows the diagram only. This is the cleanest view for reading.

Mermaid block in Show diagram mode

NocoDocs saves the current mode on the block. All readers see the view that the author selected last. New blocks use these defaults:

UserDefault mode
EditingShow code
Read-only viewersShow diagram

Expand & Download

When the diagram is visible, two more actions show in the toolbar:

ActionWhat it does
Expand diagramOpens the diagram in a full-screen modal. You can also click the diagram to expand it.
Download imageDownloads the rendered diagram as an .svg file.

Expand and Download buttons in the Mermaid block toolbar

Diagram opened in the full-screen modal

Theme

Diagrams use a palette that matches NocoDB. They change automatically between light and dark variants to match the editor theme.

Errors

If the Mermaid source is not valid, an inline error message shows in place of the diagram. The message gives the reason from the parser. NocoDocs keeps the source. To fix it, change back to Show code.

Inline error message shown when Mermaid syntax is invalid

Supported Diagram Types

NocoDocs supports all diagram types of Mermaid. The most common types are below.

Flowchart

Show processes, decisions, and branching logic.

Flowchart

Sequence Diagram

Show interactions between participants over time.

Sequence diagram

Class Diagram

Model object-oriented structures, attributes, and relationships.

Class diagram

State Diagram

Show state transitions and finite-state machines.

State diagram

Entity Relationship Diagram

Describe database schemas and table relationships.

ER diagram

Gantt Chart

Plan project timelines, dependencies, and milestones.

Gantt chart

Pie Chart

Show proportional breakdowns of a whole.

Pie chart

User Journey

Map user steps and satisfaction across a workflow.

User journey

Git Graph

Illustrate branches, commits, and merges.

Git graph

Mind Map

Organize hierarchical ideas around a central topic.

Mind map

Timeline

Track events along a chronological axis.

Timeline

Sankey Diagram

Show flows and proportions between categories.

Sankey diagram

XY Chart

Plot data series on cartesian axes (line, bar).

XY chart

C4 Diagram

Document software architecture at different levels of detail.

C4 diagram

Exports

Mermaid diagrams stay in the document when you export the document:

  • HTML and PDF exports embed the rendered SVG diagram inline.
  • Markdown exports keep the source as a ```mermaid fenced code block. GitHub, Obsidian, and other viewers that support Mermaid render it automatically.
Refer to the Mermaid documentation for the full syntax reference and the diagram types supported.

Last updated on

Latest product updates?See Changelog
Stay in the loop? Follow us onLinkedInLinkedInYouTubeYouTubeXX