Mermaid diagrams

Insert diagrams from Markdown and export them with the document.

MarkStudio Pro includes Mermaid starter templates, live preview rendering, theme-aware colors, and export handling for Word, PDF, and HTML.

Syntax

Mermaid diagrams use fenced code blocks with mermaid as the language:

```mermaid
flowchart LR
    Edit[Markdown editor] --> Preview[Live preview]
    Preview --> Export[Word / PDF / HTML]
```

Use the app's Mermaid toolbar/menu starters when you want the correct block structure inserted for you.

Starter diagrams

Diagram familyUse it forStarter keyword
FlowchartProcesses, routing, decisions, system flowflowchart TD or flowchart LR
Sequence diagramMessages between users, services, or componentssequenceDiagram
Class diagramTypes, methods, fields, and relationshipsclassDiagram
State diagramLifecycle and status transitionsstateDiagram-v2
ER diagramEntity and database relationshipserDiagram
GanttSchedules and project phasesgantt
TimelineChronological eventstimeline
MindmapHierarchical notes and topic mapsmindmap
Git graphBranching and merge history diagramsgitGraph
User journeySteps, actors, and experience ratingsjourney
Pie chartSimple proportional breakdownspie

Preview behavior

The preview renders Mermaid diagrams with the active Normal or Paperback palette. Theme and palette switches recolor loaded diagrams without changing the Markdown source.

Large diagrams can be wider than the document measure. The preview keeps them readable with responsive layout first and scrolling only when the diagram cannot fit cleanly.

Export behavior

  • HTML: best fidelity for diagrams because it preserves the browser preview path.
  • Word: includes Mermaid diagrams by default and lets you disable them in the export dialog. Complex diagrams may be rasterized for compatibility.
  • PDF: includes Mermaid diagrams by default and lets you disable them. Landscape mode is often better for wide diagrams.

Tips

  • Use short labels when exporting to Word or PDF; page size limits matter.
  • Prefer HTML export when diagram color fidelity and wide layout matter most.
  • If a diagram is too wide, try left-to-right flowcharts, landscape PDF, or split the diagram into smaller blocks.
  • Right-click a rendered Mermaid diagram in preview to use diagram-specific preview actions where available.