Mermaid Diagrams in Docs
Mermaid diagrams let you write flowcharts, sequence diagrams, Gantt charts, ER diagrams, state machines, and pie charts as plain text, which WP Super Docs renders as interactive SVG diagrams.
Adding a diagram#
Add a Custom HTML block and write your diagram inside a <pre><code class="language-mermaid"> block, using Mermaid’s own syntax:
<pre><code class="language-mermaid">
flowchart TD
A[Start] --> B{Logged in?}
B -->|Yes| C[Show dashboard]
B -->|No| D[Show login]
</code></pre>
flowchart TD
A[Start] --> B{Logged in?}
B -->|Yes| C[Show dashboard]
B -->|No| D[Show login]
This is the same block-and-class approach used for regular code blocks (see Code Blocks: Syntax Highlighting & Copy Button), just with language-mermaid instead of a specific programming language.
What Mermaid supports#
Mermaid’s own syntax covers a wide range of diagram types, including flowcharts, sequence diagrams, Gantt charts, entity-relationship diagrams, state machines, and pie charts. The full syntax reference lives at mermaid.js.org, since it’s a general-purpose diagramming library, not something specific to WP Super Docs.
Mermaid ships with the plugin and loads from your own site, with no requests to outside servers.
Dark mode#
Diagrams automatically switch between light and dark Mermaid themes to match whichever mode the reader is using. You don’t need separate versions of a diagram for light and dark mode.
Performance#
The Mermaid library only loads on doc pages that actually contain a diagram. Docs without any Mermaid syntax aren’t affected and don’t load anything extra.
Was this helpful?
Thanks for your feedback!
✓ Feedback received. Thank you!