Skip to content

YAML Frontmatter

Add YAML frontmatter at the top of your .mmd files to configure diagram-specific settings like themes, fonts, and layout options.

Frontmatter is enclosed between --- delimiters at the start of your file:

---
title: User Authentication Flow
config:
theme: dark
look: handDrawn
---
flowchart TD
A[Login Page] --> B{Valid credentials?}
B -->|Yes| C[Dashboard]
B -->|No| D[Error Message]

The frontmatter block gets full YAML syntax highlighting and validation.

Set the diagram theme:

---
config:
theme: forest
---

Available themes: default, dark, forest, neutral, base

Add a title that appears above your diagram:

---
title: System Architecture
---

Each diagram type has its own configuration options:

---
config:
flowchart:
curve: basis
padding: 20
sequence:
mirrorActors: false
---

For all available configuration options, see the Mermaid.js configuration documentation.