Skip to content

Interchangeable marimo markdown format for Slidev + marimo edit #5

@lucharo

Description

@lucharo

Vision

Create a single markdown format that works as:

  1. A marimo notebook (marimo edit notebook.md)
  2. A Slidev presentation (slidev notebook.md)

Current State

Marimo has nb.md format using code fences with {.marimo} class:

import marimo as mo

Slidev uses marimo-live code fences or <MarimoCell> components to reference cells.

Proposed Format

Extend marimo's nb.md format with:

  1. Slide separators (---) that marimo ignores but Slidev uses
  2. Cell naming via attributes or comments
  3. <MarimoCell> references between slides

Example:

---
title: My Notebook/Presentation
marimo-version: 0.19.7
---

\`\`\`python {.marimo name="imports"}
import marimo as mo
import altair as alt
\`\`\`

\`\`\`python {.marimo name="slider"}
slider = mo.ui.slider(1, 100)
slider
\`\`\`

---

# Slide 1: Interactive Demo

<MarimoCell cell="slider" />

---

# Slide 2: Results

<MarimoCell cell="chart" />

How It Would Work

For marimo edit notebook.md

  • Marimo reads code fences with {.marimo}, ignores --- and <MarimoCell>
  • Runs as normal reactive notebook

For slidev notebook.md

  • Slidev addon:
    1. Starts marimo kernel in headless mode (background process)
    2. Renders slides with <MarimoCell> components
    3. Components fetch output from running kernel

Benefits

  • Single source of truth
  • Full IDE support for Python code
  • Works offline in either mode
  • No code duplication between notebook and slides

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions