a post with marimo snippets

marimo notebooks can run Python directly in the reader’s browser. Opt a page in from its front matter:

---
layout: post
title: a post with marimo snippets
marimo: true
---

Nothing is loaded on pages without that flag, so bundling the plugin costs nothing site-wide.

Runnable snippets

Wrap fenced Python blocks in a container and the runtime turns them into an interactive notebook after the page loads:

import marimo as mo

slider = mo.ui.slider(1, 20, value=5, label="n")
slider
mo.md(f"The first {slider.value} squares: {[i**2 for i in range(1, slider.value + 1)]}")

Until the runtime has moved those blocks into place the container stays hidden, so readers never see the raw source flash before it becomes a notebook.

Embedding a hosted notebook

If you already publish a notebook — on marimo.app or your own WASM host — embed it instead:

{% al_marimo_embed src="https://marimo.app/l/your-notebook" height="700px" caption="Sampling demo" %}

The frame is sandboxed without allow-same-origin, so the embedded notebook cannot reach this page’s storage or cookies.

A note on what this loads

The marimo-snippets runtime is vendored into the plugin at a pinned version and served from your own site, rather than pulled from a CDN — so no third-party origin executes script in your readers’ pages. Running a notebook does contact marimo’s host, which is worth knowing before you opt a page in.




Enjoy Reading This Article?

Here are some more articles you might like to read next: