Mermaid diagrams and math in Markdown
In markoto, a diagram is a fenced code block with the language mermaid, and a formula is LaTeX between dollar signs. Both are drawn in the live preview while you type, on the same pages as the rest of the document, and the PDF has them exactly where the preview put them. The text stays plain Markdown that other tools can read.
Change the example below and watch the pages update.
# Release review
## How a change ships
```mermaid
flowchart LR
PR[Pull request] --> CI{Checks pass?}
CI -->|yes| Review[Review]
CI -->|no| PR
Review --> Release[Release]
```
## Error budget
With an availability target of $99.9\%$, a 30-day month allows
$$
(1 - 0.999) \times 30 \times 24 \times 60 \approx 43.2 \text{ minutes}
$$
of downtime.
```mermaid
pie title Where the downtime went
"Deploys" : 18
"Database" : 12
"Network" : 6
```
flowchart LR
PR[Pull request] --> CI{Checks pass?}
CI -->|yes| Review[Review]
CI -->|no| PR
Review --> Release[Release]
With an availability target of , a 30-day month allows
of downtime.
pie title Where the downtime went
"Deploys" : 18
"Database" : 12
"Network" : 6
Diagrams with Mermaid
Mermaid turns a few lines of text into a diagram. markoto supports flowcharts, sequence, class, state and ER diagrams, Gantt charts, pie charts, mind maps, Git graphs and timelines. The Insert › Diagram menu adds a working starter for the common kinds, so you don't have to remember the syntax.
A flowchart:
```mermaid
flowchart TD
A[Draft] --> B{Approved?}
B -->|yes| C[Publish]
B -->|no| D[Revise]
D --> A
```flowchart TD
A[Draft] --> B{Approved?}
B -->|yes| C[Publish]
B -->|no| D[Revise]
D --> A
A sequence diagram:
```mermaid
sequenceDiagram
Browser->>Server: GET /report
Server->>Database: query
Database-->>Server: rows
Server-->>Browser: 200 OK
```sequenceDiagram
Browser->>Server: GET /report
Server->>Database: query
Database-->>Server: rows
Server-->>Browser: 200 OK
A state diagram:
```mermaid
stateDiagram-v2
[*] --> Draft
Draft --> InReview : submit
InReview --> Draft : changes requested
InReview --> Published : approve
Published --> [*]
```stateDiagram-v2
[*] --> Draft
Draft --> InReview : submit
InReview --> Draft : changes requested
InReview --> Published : approve
Published --> [*]
Diagrams that fit the page
A diagram in markoto is part of a printed document, so it follows the document's theme:
- The document's font. Labels are set in the body font and stay real text in the PDF, so they are sharp at any zoom and can be selected and searched.
- The document's colours. The default diagram style takes its colours from the theme (accent, headings, text, paper). You can switch to one of Mermaid's own styles in the theme panel.
- Kept on one page. A diagram is never split across a page break. Large diagrams are scaled to the text width and to under half the page height; pie charts are drawn smaller.

Math with KaTeX
Write LaTeX math between single dollar signs for a formula inside a sentence, or between $$ lines for a formula on its own line. markoto draws it with KaTeX, which covers the LaTeX math most people use: fractions, sums and integrals, matrices, Greek letters, aligned equations.
The area of a circle is $A = \pi r^2$.
$$
\int_0^1 x^2 \, dx = \frac{1}{3}
$$The area of a circle is .
Aligned steps and matrices:
$$
\begin{aligned}
(a + b)^2 &= (a + b)(a + b) \\
&= a^2 + 2ab + b^2
\end{aligned}
$$
$$
M = \begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}
$$
Write \$ when you mean a literal dollar sign. A formula with a mistake is shown in red instead of breaking the rest of the page.
Around the diagrams
The same documents usually need more than a diagram. markoto also renders:
- Alerts:
> [!NOTE],[!TIP],[!IMPORTANT],[!WARNING]and[!CAUTION]callouts, as on GitHub. - Footnotes, placed at the foot of the page they belong to.
- Highlighted code blocks for most languages.
- A table of contents with page numbers, written as
[[toc]]. - Page breaks where you put
<!-- pagebreak -->.
The Markdown cheat sheet lists every syntax with examples.
Where it falls short
- Mermaid only. Graphviz, PlantUML, Vega-Lite and music notation are not rendered; they show as code blocks.
- KaTeX, not full LaTeX. KaTeX draws LaTeX math, but there are no LaTeX packages, document classes or macro files. For papers that need those, LaTeX or Typst fits better; see markoto vs Overleaf and markoto vs Typst.
- No drawing tool. Diagrams are written as text. There is no canvas to drag boxes around.
- Six citation styles. Citations from BibTeX work (Citations, bibliography and cross-references), but only in the built-in styles.
Questions
How do I add a Mermaid diagram to Markdown?
Which Mermaid diagram types work?
Do the diagrams and formulas appear in the PDF?
Is the math syntax LaTeX?
Will my Markdown still work in other editors?
Do I need an account?
Updated November 19, 2026
