Skip to content
A

Markdown

Loading the Python runtime…

Part 4 of 10 in Learn marimo.

Tip: toggling between the Markdown and Python editor

Although markdown is written with mo.md, marimo provides a markdown editor that hides this boilerplate from you, for cells that only contain mo.md(...).

Toggle between the Markdown and Python editors by clicking the blue icon in the top-right of the editor, entering Ctrl/Cmd+Shift+M, or using the “cell actions menu”. You can also hide the markdown editor through the cell actions menu.

Tip: To interpolate Python values into markdown strings, you’ll need to use a Python f-string; do this by checking the f box in the bottom-right corner of the markdown editor, or with mo.md(f"...") in the Python view.

/// Tip | Admonitions Write admonitions or callouts with the following syntax:

/// Tip | Title
Admonition text body
///

Supported kinds include Note, Tip, Hint, Important, Warning, and Danger. ///

/// Note | r'' strings Use r'' strings to remove the need to escape backslashes when writing LaTeX. ///

/// Note | KaTeX marimo uses KaTeX, a math typesetting library for the web which supports a subset of LaTeX. For a list of (un)supported commands, visit https://katex.org/docs/support_table ///

You can interpolate Python values into markdown using f-strings and marimo’s as_html function. This lets you create markdown whose contents depend on data that changes at runtime.

Here are some examples.

Here’s a more interesting example that puts together everything we’ve learned: rendering markdown with LaTeX that depends on the values of Python objects.