Skip to content

Markdown cells

igaurab edited this page Nov 18, 2026 · 2 revisions

A markdown cell shows formatted text: headings, lists, code, links and pictures. It has no editor on the screen until you open it. A markdown cell does not run.

Tasks

Task How
Make a markdown cell In cell mode, press m. Or type :md
Change it back to code In cell mode, press y. Or type :code
Edit the text Select the cell and press enter or i. Or double-click the cell
Show the formatted text escape escape, shift+enter, ctrl+enter, or move to a different cell
Fold or unfold the cell h in cell mode, :hide / :show

shift+enter shows the text and goes to the next cell. ctrl+enter shows the text and stays.

With --no-vim, one escape is sufficient.

When you change a code cell to markdown

The variables of the cell go away. The cells that used them become stale. In reactive mode, those cells run again and fail.

Pictures

Text in the cell Result
![alt](url-or-path) The picture shows in the cell
[text](x.png) A link to a picture file also shows as a picture
  • The source can be an http or https address, a data: URL, or a file path.
  • A relative path starts from the folder of the notebook.
  • Animated GIFs play.
  • gpython loads pictures in the background. The cell shows ⌛ alt until the picture arrives, and 🌆 alt with the cause if it fails.
  • gpython keeps downloaded pictures in ~/.cache/gpython/images. Thus they show immediately the next time.
  • v in cell mode and :img also work on the pictures of a markdown cell. See Images.

Large headings (experimental)

gpython can draw h1 to h3 headings in a larger font, as images. This function is off by default. To turn it on, add this to the config file:

[experimental]
true_markdown = true

It needs a terminal with the kitty graphics protocol and Unicode placeholders (Kitty, Ghostty). It does not work in tmux. Elsewhere, gpython shows the headings as text. GPYTHON_BIG_HEADINGS=0 turns it off for one session.

How markdown cells are stored

File type Storage
.py with # %% markers # %% [markdown], then lines that start with # (the Jupytext format)
Plain .py script A top-level """text""" string is a markdown cell
marimo notebook A mo.md(...) cell. gpython shows it and does not run it
.ipynb A markdown cell

A code cell whose last line is only a string ("""note""") does not print that string as its result.

Clone this wiki locally