Pre-Rendering¶
Show output instantly on page load using the pre-render attribute. Pre-rendered fences execute Panel code at build time and embed the static HTML output — users see results before Pyodide even starts downloading.
Pre-render + auto-run (recommended)¶
Set pre-render="true" auto-run="true" to show output instantly and transition to interactive when Pyodide loads:
Best for showcases and demos — users see results immediately, and the app becomes interactive in the background.
Pre-render + no auto-run¶
Set pre-render="true" auto-run="false" to show static output that stays until the user clicks Run:
Best for documentation with many examples — avoids downloading Pyodide until the user explicitly wants interactivity.
No pre-render + auto-run¶
Omit pre-render with auto-run="true" to show a loading spinner, then output:
Best when pre-rendering is not available in the build environment.
No pre-render + no auto-run¶
Omit pre-render with auto-run="false" — blank until the user clicks Run:
Best for tutorials and exercises where the user should read the code first.
Fence syntax¶
MkDocs — per-fence:
MkDocs — skip pre-render on a specific fence:
```{.panel pre-render="false"}
import panel as pn
# This fence won't be pre-rendered even if enabled globally
pn.panel("Hello").servable()
```
MkDocs — site-wide via formatter: set format to panel_live.fences.prerender_formatter in your superfences config — every fence is pre-rendered without needing a hook.
Sphinx:
When to use each¶
| Combination | Output on load | Interactive | Best for |
|---|---|---|---|
pre-render="true" + auto-run="true" |
Instant | Auto | Showcases, demos |
pre-render="true" + auto-run="false" |
Instant (static) | On click | Docs with many examples |
auto-run="true" (no pre-render) |
After Pyodide loads | Auto | No build-time Panel |
auto-run="false" (no pre-render) |
Blank | On click | Tutorials, exercises |