Skip to content

Cells and syntax

Notebook cells live inside markdown container directives named cell. Text outside those blocks stays ordinary markdown.

Each cell needs a stable id and a language:

:::cell{#load-data lang="ts"}
```ts
const tag = "project/alpha";
lapis.markdown(`Filtering notes tagged **${tag}**.`);
```
:::

Supported lang values:

LanguageUse for
ts / jsCalculations, inputs, vault reads, charts
sqlDuckDB queries over registered files or app tables
mdDynamic markdown with {{variable}} placeholders

Python (py / python) is not supported in the current runtime.

If you omit lang, Lapis infers it from the fenced code block info string when possible, otherwise it defaults to ts.

---
notebook:
version: 1
autorun: false
mode: lazy
---
  • autorun — per-note override for stale-cell auto-runs after edits
  • mode — reserved metadata; execution still requires explicit runs unless auto-run is enabled
# Weekly review
This paragraph is not executable.
:::cell{#matching-notes lang="sql"}
```sql
SELECT path, name
FROM lapis.notes
ORDER BY name
LIMIT 10
```
:::

In a .notebook.md source editor, type / to insert canonical templates for:

  • /code — JavaScript/TypeScript cell
  • /sql — SQL cell
  • /input — input cell with view(...)
  • /markdown — dynamic markdown cell

Cell ids (#load-data, #summary, and so on) identify cells in the dependency graph, Variables panel, and error messages. Reuse ids carefully; duplicate definitions are reported as errors.