Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

docs: document public folder (#3548)

Myles Scolnick01c1745634ed
diff --git a/docs/api/markdown.md b/docs/api/markdown.md
index 6a5ece5b2b..c398643ca7 100644
--- a/docs/api/markdown.md
+++ b/docs/api/markdown.md
@@ -30,3 +30,17 @@ mo.ui.button(
label='<div data-tooltip="This is a tooltip">Hover over me</div>'
)
```
+
+## Rendering images
+
+You can render images from a local `public/` folder:
+
+```python
+mo.md(
+ '''
+ <img src="public/image.png" width="100" />
+ '''
+)
+```
+
+See [Static files](../guides/outputs.md#static-files) for information about serving images and other static assets.
diff --git a/docs/guides/outputs.md b/docs/guides/outputs.md
index 91e067d31e..4fa9f2ff93 100644
--- a/docs/guides/outputs.md
+++ b/docs/guides/outputs.md
@@ -62,6 +62,30 @@ mo.md(
)
```
+### Static files
+
+marimo supports serving static files from a `public/` folder located next to your notebook. This is useful for including images or other static assets in your notebook.
+
+To use files from the public folder, create a `public` directory next to your notebook and reference files using the `public/` path prefix:
+
+```python
+mo.md(
+ '''
+ <img src="public/image.png" width="100" />
+
+ or
+
+ ![alt text](public/image.png)
+ '''
+)
+```
+
+For security reasons:
+
+- Only files within the `public` directory can be accessed
+- Symlinks are not followed
+- Path traversal attempts (e.g., `../`) are blocked
+
### Markdown editor
marimo automatically renders cells that only use `mo.md("")`, without an