EM4me

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 x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2-4ac}}{2a} 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}
$$

i=1ni=n(n+1)2\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]
```

yes

no

Start

Decision

Implement

Discard

yes

no

Start

Decision

Implement

Discard

Source
flowchart LR
  A[Start] --> B{Decision}
  B -->|yes| C[Implement]
  B -->|no| D[Discard]

Sequence

AppUserAppUseropen filerendered view
AppUserAppUseropen filerendered view
Source
sequenceDiagram
  participant U as User
  participant A as App
  U->>A: open file
  A-->>U: rendered view

Gantt

2026-01-012026-01-032026-01-052026-01-072026-01-092026-01-112026-01-132026-01-152026-01-172026-01-192026-01-212026-01-232026-01-25Concept Implementation Phase 1Mini plan
2026-01-012026-01-032026-01-052026-01-072026-01-092026-01-112026-01-132026-01-152026-01-172026-01-192026-01-212026-01-232026-01-25Concept Implementation Phase 1Mini plan
Source
gantt
  dateFormat YYYY-MM-DD
  title Mini plan
  section Phase 1
  Concept        :a1, 2026-01-01, 10d
  Implementation :after a1, 15d

Class

1

*

Tab

+path

+viewMode

+close()

Pane

1

*

Tab

+path

+viewMode

+close()

Pane

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.