← All guides

Mermaid in Notion, Obsidian, and GitBook

Last updated: 2026-05-01

Mermaid has quietly become the lingua franca of diagrams in note-taking and documentation tools. The big three each render it natively, but with different keyboard shortcuts, theme behaviour, and renderer versions. This guide covers what to expect.

Notion

Notion supports Mermaid inside Code blocks. Type /code, choose Mermaid as the language, paste the source, and click Preview in the bottom-right of the block to flip between source and rendering. The preview updates live, so you can iterate without leaving the page.

Things to know:

If you draft a diagram here and want a different theme, our preview lets you switch to dark / forest / neutral and copy the rendered SVG; embed the SVG as an image in Notion if the look matters.

Obsidian

Obsidian renders Mermaid inside fenced code blocks just like GitHub:

```mermaid
flowchart TD
  Idea --> Daily[Daily note]
  Daily --> Weekly[Weekly review]
  Weekly --> Project[Project page]
```

Rendering happens locally in the Obsidian app, which is excellent for privacy and instant feedback. A few things to keep in mind:

GitBook

GitBook supports Mermaid via its standard “Code block” with mermaid as the language. Unlike Notion, GitBook publishes the rendered SVG to its public hosting, which means anyone can view-source on a published GitBook page and recover your Mermaid source. That is fine for public docs, but worth knowing if you are using GitBook as an internal-only knowledge base — treat your diagrams as world-readable.

Drafting once, embedding everywhere

The shortest workflow is:

  1. Draft in our live preview — you see syntax errors immediately, you can pick a theme, and you get a share URL.
  2. Once it renders the way you want, copy the source.
  3. Paste into the destination tool’s code block. None of the tools above require any modification of the Mermaid source.

If the destination tool’s renderer chokes on something the preview accepts, you have probably hit a version skew. The most common culprits:

When tools fall short

If you need consistent rendering across Notion, Obsidian, and GitBook simultaneously, the only durable answer is to render to SVG once and embed the SVG. Notion accepts SVG image uploads, GitBook accepts them as image blocks, and Obsidian renders them through standard image links. The Mermaid source lives in a .md file in your repo so you can re-render later, but the published surface is a static image.

Use the SVG download button in the preview to produce that file in one click.


Open the live preview · Diagram types · More guides