Math and diagrams
KaTeX typesets formulas, Mermaid renders diagrams, code blocks get syntax highlighting — in Reading view, split view and Live mode alike.
KaTeX inline
Formulas between single dollar signs render within running text. A heuristic protects dollar amounts: $100 in a sentence stays text, only real formula pairs are typeset.
The solution is $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$ by the quadratic formula.
The solution is by the quadratic formula.
KaTeX as a block
Double dollar signs typeset a standalone, centred formula.
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
Mermaid
Code blocks with the mermaid language tag render as SVG diagrams and follow the theme. The common types:
Flowchart
```mermaid
flowchart LR
A[Start] --> B{Decision}
B -->|yes| C[Implement]
B -->|no| D[Discard]
```
Source
flowchart LR
A[Start] --> B{Decision}
B -->|yes| C[Implement]
B -->|no| D[Discard]
Sequence
Source
sequenceDiagram
participant U as User
participant A as App
U->>A: open file
A-->>U: rendered view
Gantt
Source
gantt
dateFormat YYYY-MM-DD
title Mini plan
section Phase 1
Concept :a1, 2026-01-01, 10d
Implementation :after a1, 15d
Class
Source
classDiagram
class Tab {
+path
+viewMode
+close()
}
class Pane
Pane "1" --> "*" Tab
Code blocks with syntax highlighting
A language tag after the opening backticks enables the colour palette (follows the theme):
```javascript
function greet(name) {
return `Hello, ${name}!`;
}
```
function greet(name) {
return `Hello, ${name}!`;
}
The copy button at the top right of the block copies the content to the clipboard — here in the manual too.
Export
- PDF export: diagrams are printed as rendered vector graphics, redrawn in light colors for print; formulas and code highlighting appear as in the preview.
- Portable Markdown: the export burns the diagram into the file as a finished image — the recipient sees it without owning this program. It is always drawn light, no matter which colour scheme you work in. A diagram with faulty source text is left untouched as a code block so that you do not lose the source; the same applies when the «Mermaid diagrams» extension is switched off. The diagram sits in the file as an image with an embedded address; this requires a Markdown viewer that renders embedded HTML and such images — for the HTML the same requirement as for exported Perspective tables. KaTeX formulas and code blocks with a language tag are ordinary Markdown syntax and remain unaffected.