Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Authoring cells

Use the marimo MyST directive with an explicit language argument. The language must be exactly python, sql, or markdown.

```{marimo} python
import marimo as mo

slider = mo.ui.slider(start=1, stop=10, label="islands")
slider
```

```{marimo} python
mo.md(f"The slider is set to **{slider.value}**.")
```

Python cells can read names defined by earlier cells and by the page header. SQL and Markdown cells are converted to Python before execution and import marimo internally.

Cell Options

Write options with standard MyST directive syntax:

```{marimo} python
:echo: true
:output: true

import marimo as mo
mo.md("show source and output")
```
OptionTypeDefaultBehavior
:eval:booleantrueExecute the cell during the build
:echo:booleanfalseRender source as static code
:editor:booleanfalseRender source in a marimo code editor
:output:booleantrueRender the browser output island
:server-output:booleantrueInclude build-time preview HTML in the output island
:error:booleantrueRender marimo error output instead of failing on error MIME output
:include:booleantrueKeep this cell’s visible node in the page
:hide-code:booleanfalseHide rendered source when page defaults would show it
:hide-output:booleanfalseHide rendered output when page defaults would show it
:disabled:booleanfalseSkip execution and keep optional visible source
:unparsable:booleanfalseSkip parsing intentionally invalid code
:name:stringnoneSet the marimo cell name
:column:numbernoneSet the marimo column index

Unsupported options fail the build before execution. The plugin also rejects a single directive that explicitly sets both sides of these option pairs:

Visibility options are presentational. Executed cells are serialized into the static page so marimo can hydrate islands in the browser. Do not put credentials, private logic, or untrusted input in cells that ship with a public book.

Execution And Visibility

include controls the visible node, not execution. Use :include: false when a cell should run for downstream cells but should not render code or output in the page. Use :eval: false, :disabled: true, or :unparsable: true when the cell should not run.

Use :server-output: false when a cell should execute and hydrate in the browser with an empty build-time preview. The page keeps the shared notebook source and runtime payload. That cell’s <marimo-cell-output> starts empty.

Use :error: false for strict builds. If marimo execution produces an error MIME renderer, the build fails at that cell. Successful output keeps text, HTML, and other non-error MIME renderers.

SQL cells

SQL cells use the same directive with the sql language argument:

```{marimo} sql
:query: result

SELECT *
FROM my_table
WHERE value > 10
```

SQL options:

OptionTypeDefaultBehavior
:query:string_dfPython variable name for the SQL result
:engine:stringnonePython expression naming the marimo SQL engine

query and engine are SQL-only options. If query is missing or is not a valid Python identifier, the plugin uses _df.

Markdown cells

Markdown cells join the page-level marimo execution graph:

```{marimo} markdown
# A marimo-rendered heading

The Markdown block executes as a marimo Markdown cell.
```

Use ordinary MyST outside marimo cells for static book content.

Page Defaults

Use {marimo-config} once per page when cells should share defaults, header code, or dependencies:

```{marimo-config}
:header: |
  import marimo as mo
:echo: true
```

Cell options override page defaults. See Page configuration.