how to add mermaid diagram in confluence

How to Embed Mermaid Diagrams in Confluence

By James Thomas
AD

Are you eager to enhance your Confluence pages with visual, semantic diagrams? Mermaid diagrams offer a dynamic way to display algorithms, flowcharts, sequence diagrams, and more. Here's how you can add mermaid diagrams in Confluence to make your content more engaging and informative.

Before we dive in, ensure your Confluence server or site admin has enabled the 'Mermaid' plugin. If not installed, you can request it from your admin. Once enabled, follow these steps for an effortless mermaid diagram integration.

Writing Mermaid Diagrams

First, you need to understand the Markdown-like syntax used by Mermaid. It's simple and intuitive:

AD
an info sheet showing how to draw mermaids
an info sheet showing how to draw mermaids
Insert and edit a Mermaid diagram | draw.io
Insert and edit a Mermaid diagram | draw.io
Mermaid: Create diagrams quickly and effortlessly | Towards Data Science
Mermaid: Create diagrams quickly and effortlessly | Towards Data Science

```mermaid graph LR A[Start] --> B[Is it raining?] B -->|Yes| C[Take bus] B -->|No| D[Take car] C --> E[Sleep on the bus] D --> E E --> F[Reach office] ```

Basic Syntax

Create a new paragraph in Confluence and wrap your Mermaid code inside a triple backtick (```) followed by 'mermaid' and closing with another triple backtick.

Mermaid: Automate Visualization of Workflows, Funnels, Systems and Journeys
Mermaid: Automate Visualization of Workflows, Funnels, Systems and Journeys
How to Create Diagrams as Code with Mermaid, GitHub, and Visual Studio Code
How to Create Diagrams as Code with Mermaid, GitHub, and Visual Studio Code
GitHubでMermaid記法がサポートされたので、練習としてFF14のサベネアの野菜作成のフローチャートを作った話
GitHubでMermaid記法がサポートされたので、練習としてFF14のサベネアの野菜作成のフローチャートを作った話

In the example above, we've created a flowchart illustrating a rainy day's commute decision. The 'graph LR' at the start sets the diagram type (flowchart) with a left-to-right orientation.

Diagram Types

Mermaid supports various diagram types, including flowcharts, sequence diagrams, class diagrams, and more. Each has its specific syntax, so explore the Mermaid live editor to learn and experiment.

AD

Here's a simple sequence diagram:

How to Use the Mermaid JavaScript Library to Create Flowcharts
How to Use the Mermaid JavaScript Library to Create Flowcharts
the anatomy of a mermaid tail and its features on it's side, as well as
the anatomy of a mermaid tail and its features on it's side, as well as
a drawing of a mermaid with some words written on the bottom and bottom half of it
a drawing of a mermaid with some words written on the bottom and bottom half of it
an image of the anatomy of a mermaid
an image of the anatomy of a mermaid
the instructions for how to wear slippers in different positions and sizes, from an old fashion
the instructions for how to wear slippers in different positions and sizes, from an old fashion
three different views of the human body
three different views of the human body

```mermaid sequenceDiagram participant A as Alice participant B as Bob A->>B: Hi Bob, how are you? B->>A: I am good, thank you! ```

Viewing and Updating Mermaid Diagrams

The magic happens once you publish your page. Confluence will convert the Markdown into an interactive, resizable diagram.

AD

To update or correct a diagram, edit the page, click on the offending diagram, and click the pencil icon to open the inline editor. Make your changes and republish the page.

an iphone screen with the texting app on it and two screens showing how to use them
an iphone screen with the texting app on it and two screens showing how to use them
an image of a mermaid sitting on the beach with text below it that reads, what is
an image of a mermaid sitting on the beach with text below it that reads, what is
step by step instructions for how to draw mermaids in different poses and sizes, including the
step by step instructions for how to draw mermaids in different poses and sizes, including the

Troubleshooting

If you've written a valid Mermaid diagram but Confluence isn't showing it, ensure the 'Mermaid' plugin is enabled by checking with your Confluence admin.

Diagram still not appearing? Try breaking your diagram into smaller, more manageable pieces.

AD

Adding mermaid diagrams to your Confluence pages allows for better visual communication, making complex ideas more accessible. Keep experimenting with different diagram types and find what works best for you. Happy diagramming!

AD