Typora Mermaid Diagrams
Typora Mermaid diagrams are mermaid code fences in a Markdown document. Typora draws the fence as you type and exports the diagram with the document. On Typora 1.x, turn Diagrams on in the Preferences Panel under Markdown. Typora 2 draws the fence with Pele, and the Mermaid.js extension draws it with the official library.
Step-by-Step Guide
Enable diagrams in Preferences
Typora's Draw Diagrams With Markdown guide says to enable Diagrams first. Open the Preferences Panel and turn Diagrams on in the Markdown section. The Typora 1.1 notes use that same path: Preferences Panel → Markdown. Typora 1.6 adds a link for diagram configuration at Preferences Panel → Markdown → Syntax Support → Diagrams. The current diagrams guide, written for Typora 2, does not list a separate switch. A mermaid fence renders as you type. Pele is the built-in renderer. For a drawing that matches Mermaid.js, install the Mermaid.js extension and choose it in Settings ▸ Markdown ▸ Syntax by Extension. Typora 1.0 cannot install extensions.
Write a mermaid code fence
Start a fenced code block and set the language to mermaid. Typora's diagrams guide uses that fence for flowcharts, sequence diagrams, class diagrams, state diagrams, Gantt charts, and other Mermaid diagrams. The languages flow and sequence are other engines, flowchart.js and js-sequence-diagrams, so Mermaid source stays in a mermaid fence. Click the diagram to edit the source beside the preview or stacked with it. The toolbar opens the diagram full screen, where you can zoom and pan.
```mermaid
graph LR
Draft --> Review --> Publish
```Use the diagram types Typora documents
Typora's Mermaid article documents sequence diagrams, flowcharts, Gantt charts, class diagrams, state diagrams, and pie charts. It also documents requirement diagrams, Git graphs, C4 diagrams, mind maps, timelines, quadrant charts, Sankey diagrams, ZenUML, and XY charts. Typora 1.6 added timelines when it upgraded the bundled Mermaid library to version 10. That article says ZenUML is not a first-class diagram and may lack features such as dark themes. Pele follows Mermaid syntax with its own layout. The Mermaid.js extension for Typora 2.0 draws the fence with Mermaid 11.16.0. Typora's extension page describes that renderer as the one that matches GitHub, GitLab, and the Mermaid Live Editor. This editor also renders with Mermaid.js. Install the extension from Settings ▸ Extensions. To go back to Pele, choose Typora (Pele) for mermaid under Settings ▸ Markdown ▸ Syntax by Extension, or disable the extension.
```mermaid
sequenceDiagram
Alice->>Bob: Is the draft ready?
Bob-->>Alice: Ready to export
```Export the document or save the diagram
The diagrams guide says a diagram exports with the document. The support article names the formats: HTML, PDF, EPUB, and DOCX include the rendered diagrams. Exporting Markdown to other file formats does not include diagram features. Mermaid fences are outside standard Markdown, CommonMark, and GFM, so Typora recommends an image when the file will be read in an app that does not draw Mermaid. Right-click a diagram to save SVG, PNG, or JPG, or to copy the image. Custom CSS can set --mermaid-theme to base, default, dark, forest, neutral, or night, along with the font, sequence numbers, and flowchart curve. If you export with a theme other than the one currently open, Typora does not apply some of those Mermaid options to the exported HTML, PDF, or image.
Fix a diagram that does not render
On Typora 1.x the fence stays as code until Diagrams is enabled in Preferences Panel → Markdown. Then check the language tag. A flow or sequence fence will not draw Mermaid source. Paste the same source into this editor. A syntax error shows up there before you chase a Typora setting. If the diagram draws and the layout differs from Mermaid.js, that is Pele. On Typora 2.0, install the Mermaid.js extension and select it under Settings ▸ Markdown ▸ Syntax by Extension. If an export drops the diagram, export HTML, PDF, EPUB, or DOCX, or insert a PNG or SVG. If Custom CSS theme options are missing from the export, export with the theme that defines them.
Draft in Mermaid Editor, then paste into Typora
Open the editor, write the diagram, and copy the source once the preview renders. In Typora, paste it inside a mermaid fence. This editor renders with Mermaid.js. Typora matches that family of output when the Mermaid.js extension is the renderer for mermaid. Pele keeps Typora's own layout. When the file will be opened somewhere that does not render Mermaid, export PNG or SVG from the editor, or right-click the diagram in Typora and save SVG, PNG, or JPG, then insert the image. That is the path Typora recommends for readers outside Typora.
```mermaid
pie
title Notes by status
"Drafts" : 12
"In review" : 5
"Published" : 7
```Tips
- •On Typora 1.x, enable Diagrams in Preferences Panel → Markdown
- •Typora 2 renders a mermaid fence as you type, using Pele unless you select the Mermaid.js extension
- •Put Mermaid source in a mermaid fence. flow and sequence call other libraries
- •Choose the Mermaid.js extension in Settings ▸ Markdown ▸ Syntax by Extension. It ships Mermaid 11.16.0
- •HTML, PDF, EPUB, and DOCX include the rendered diagram. Other export formats leave the diagram feature out
- •Right-click a diagram to save SVG, PNG, or JPG, or to copy the image
- •Set --mermaid-theme in Custom CSS to base, default, dark, forest, neutral, or night
Design Your Diagram First
Use our editor with live preview, autocomplete, and theming — then copy-paste into Typora.
Open EditorFrequently asked questions
How do I enable Mermaid in Typora?
On Typora 1.x, open the Preferences Panel and enable Diagrams in the Markdown section. Typora 1.1 documents Preferences Panel → Markdown, and Typora 1.6 links diagram configuration at Preferences Panel → Markdown → Syntax Support → Diagrams. Typora 2's diagrams guide says a mermaid fence renders as you type. To draw with Mermaid.js instead of Pele, install the Mermaid.js extension and select it under Settings ▸ Markdown ▸ Syntax by Extension.
How do I write a Mermaid diagram in Typora?
Add a fenced code block with the language mermaid and put the diagram source inside it. Typora draws it as you type. Click the diagram to edit the source, and use the toolbar to open it full screen, zoom, and pan. A flow or sequence fence is a different diagram engine, so Mermaid source belongs in a mermaid fence.
Which diagram types does Typora Mermaid support?
Typora's Mermaid article documents sequence diagrams, flowcharts, Gantt charts, class diagrams, state diagrams, pie charts, requirement diagrams, Git graphs, C4 diagrams, mind maps, timelines, quadrant charts, Sankey diagrams, ZenUML, and XY charts. Timelines arrived in Typora 1.6 with Mermaid 10. The diagrams guide summarizes the mermaid language as flowcharts, sequence, class, state, Gantt, and other diagrams. Pele uses its own layout. The Typora 2 Mermaid.js extension draws with Mermaid 11.16.0.
How do Typora exports handle Mermaid diagrams?
Diagrams export with the document. Typora's support article says HTML, PDF, EPUB, and DOCX include the rendered diagrams, and other export formats do not include diagram features. Right-click a diagram to save SVG, PNG, or JPG. Mermaid fences are not standard Markdown, CommonMark, or GFM, so Typora recommends an image when another app will open the file. Exporting with a different theme than the one you have open can skip Mermaid options set in Custom CSS.
Why is my Mermaid diagram not rendering in Typora?
On Typora 1.x, enable Diagrams in Preferences Panel → Markdown. Confirm the fence language is mermaid, not flow or sequence. Preview the source in this editor to catch a syntax error. If Typora draws a different layout than Mermaid.js, Pele is the built-in renderer. On Typora 2.0, install the Mermaid.js extension and choose it in Settings ▸ Markdown ▸ Syntax by Extension.
Why does my Typora diagram look different from the editor?
Typora draws mermaid fences with Pele, which follows Mermaid syntax and uses its own layout. This editor uses Mermaid.js. Install Typora's Mermaid.js extension and select it for mermaid under Settings ▸ Markdown ▸ Syntax by Extension. The extension ships Mermaid 11.16.0. Choose Typora (Pele) in that same setting, or disable the extension, to return to the built-in renderer. Diagrams follow the light or dark appearance unless the source sets its own theme.
Can I preview a diagram before I paste it into Typora?
Yes. Write it in the Mermaid Editor, confirm the preview, and copy the source into a mermaid fence in Typora. This editor renders with Mermaid.js, and Typora's Mermaid.js extension uses that same library. With Pele, Typora keeps its own layout. For a file that will be read outside Typora, export PNG or SVG and insert the image.
More Integrations
All integrationsGitHub
Mermaid in GitHub renders from a fenced code block with the language mermaid. GitHub's creating-diagrams guide lists GitHub Issues, GitHub Discussions, pull requests, wikis, and Markdown files. A repository file with a .mermaid or .mmd extension renders when you open it. Nothing to install.
Notion
Notion supports Mermaid diagrams natively through code blocks. Type /code to create a code block, select 'Mermaid' as the language, and your diagram renders inline. No extensions needed.
VS Code
You can use Mermaid in VS Code without an extension. Paste a mermaid code block into a Markdown file and open the built-in preview. Syntax highlighting extensions and the Mermaid Chart extension add color and another preview, and this editor is where you export PNG or SVG.
Confluence
Confluence does not support Mermaid on its own. A page will not render a mermaid code fence the way GitHub does. Install a Marketplace app such as Mermaid Diagrams for Confluence to get a macro, or export a PNG or SVG from this editor and embed the image.
Obsidian
Obsidian renders Mermaid diagrams natively in reading view and live preview. No plugins needed. Just add a mermaid code block to any note and switch to reading mode to see the rendered diagram.