Skip to content

Code blocks

Use fenced code blocks when whitespace, syntax, or exact text matters.

```ts
export function title(text: string) {
return text.trim();
}
```

Lapis renders ordinary code fences in notes. Some fenced blocks also have special meaning in the app.

Lapis supports inline and block LaTeX math in notes.

Inline math: $E = mc^2$
$$
\sum_{n=1}^{5} n = 15
$$

Use Mermaid fences when a note needs a lightweight diagram.

```mermaid
flowchart LR
A[Note] --> B[Metadata cache]
B --> C[Graph]
```

Some plugins use fenced blocks as inputs to richer features. For example, search can render query blocks, and notebook documents use their own cell syntax for executable content.

  • Use ordinary code fences for source, config, commands, and snippets.
  • Use math blocks when the note needs readable equations.
  • Use Mermaid when a quick diagram belongs inside the note itself.
  • Use notebook documents when the work needs executable cells rather than a static fenced block. Start with Getting started with notebooks.