Skip to main content

marimo export

Export marimo notebooks to various formats for sharing, deployment, or integration with other tools.

Usage

Export Formats

  • html - Interactive HTML with outputs
  • html-wasm - Standalone WASM-powered HTML (runs Python in browser)
  • pdf - PDF document or slides
  • script - Flat Python script
  • md - Markdown with code fences
  • ipynb - Jupyter notebook
  • thumbnail - Generate notebook thumbnail
  • session - Export notebook session data

marimo export html

Export a notebook as an interactive HTML file with outputs.

Usage

Options

—include-code / —no-include-code - Include notebook code in HTML
  • Type: Flag
  • Default: True
-o, —output PATH - Output HTML file path
  • If not provided, HTML is printed to stdout
—watch / —no-watch - Watch for changes and regenerate
  • Default: False
  • Uses watchdog if available, otherwise polls every 1s
—sandbox / —no-sandbox - Run in isolated virtual environment
  • Requires uv
-f, —force - Force overwrite of output file
  • Default: False

Examples


marimo export html-wasm

Export as a standalone WASM-powered HTML file that runs Python in the browser.

Usage

Options

-o, —output PATH - Output directory or HTML file (required) —mode MODE - Notebook mode (required)
  • Choices: edit, run
  • edit: Code is editable in browser
  • run: Code is read-only
—show-code / —no-show-code - Show code by default (run mode only)
  • Default: False
—watch / —no-watch - Watch for changes
  • Default: False
—include-cloudflare / —no-include-cloudflare - Include Cloudflare Worker config
  • Default: False
  • Generates index.js and wrangler.jsonc for easy deployment
—sandbox / —no-sandbox - Run in isolated environment -f, —force - Force overwrite

Examples

Notes

  • Uses Pyodide to run Python in the browser
  • Must be served over HTTP (not file://)
  • Not all Python packages are supported by Pyodide
  • Creates .nojekyll file for GitHub Pages compatibility

marimo export pdf

Export a notebook as a PDF document or slides.

Usage

Options

-o, —output PATH - Output PDF file (required) —include-outputs / —no-include-outputs - Run and include outputs
  • Default: True
—include-inputs / —no-include-inputs - Include code cells
  • Default: True
—webpdf / —no-webpdf - Use WebPDF exporter (Chromium)
  • Default: True
  • If disabled, tries standard PDF (pandoc + TeX) first, falls back to WebPDF
—rasterize-outputs / —no-rasterize-outputs - Rasterize HTML/Vega outputs to PNG
  • Default: True
  • Converts interactive widgets to static images
—raster-scale SCALE - Scale factor for rasterized outputs
  • Type: Float (1.0-4.0)
  • Default: 4.0
—raster-server MODE - Server mode for raster capture
  • Choices: static, live
  • Default: static
  • Use live for outputs requiring Python connection
—as FORMAT - PDF export preset
  • Choices: document, slides
  • slides: Export as reveal.js slides
  • Auto-detected if notebook uses slides layout
—watch / —no-watch - Watch for changes —sandbox / —no-sandbox - Run in isolated environment -f, —force - Force overwrite

Dependencies

Requires: nbformat, nbconvert, nbconvert[webpdf] For rasterization: playwright

Examples


marimo export script

Export as a flat Python script in topological order.

Usage

Options

-o, —output PATH - Output script file
  • If not provided, script is printed to stdout
—watch / —no-watch - Watch for changes —sandbox / —no-sandbox - Run in isolated environment -f, —force - Force overwrite

Examples


marimo export md

Export as a code-fenced Markdown file.

Usage

Options

-o, —output PATH - Output Markdown file —watch / —no-watch - Watch for changes —sandbox / —no-sandbox - Run in isolated environment -f, —force - Force overwrite

Examples


marimo export ipynb

Export as a Jupyter notebook.

Usage

Options

-o, —output PATH - Output .ipynb file —sort MODE - Cell sort order
  • Choices: top-down, topological
  • Default: topological
—include-outputs / —no-include-outputs - Run and include outputs
  • Default: False
—watch / —no-watch - Watch for changes —sandbox / —no-sandbox - Run in isolated environment -f, —force - Force overwrite

Dependencies

Requires: nbformat

Examples


Common Options

These options are available for most export commands: —watch / —no-watch - Watch the notebook for changes and regenerate output
  • Uses watchdog if installed, otherwise polls every 1 second
  • Requires --output to be specified
—sandbox / —no-sandbox - Run in an isolated virtual environment using uv run --isolated
  • Requires uv to be installed
  • Useful for ensuring reproducible exports
-f, —force - Force overwrite of the output file without prompting

Tips

  • Use --watch during development for live previews
  • For production HTML exports, consider html-wasm for fully self-contained apps
  • PDF exports work best with --as=slides for presentation notebooks
  • Use --sandbox for reproducible exports with isolated dependencies
  • Combine --force with --watch to avoid prompts