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.

Markdown

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.

Interpolating Python values

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.

Putting it all together

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.