A Documenter.jl plugin to embed Pluto.jl notebooks inside documenter pages. This package embeds the Pluto notebook directly, without iframe.
- Julia 1.10+
- (still unreleased) Documenter 1.9+ (for
RawHTMLHeadContent), waiting for JuliaDocs/Documenter.jl#2933 - Pluto 0.20+
# docs/make.jl
using Documenter
using DocumenterPluto # `using DocumenterPluto` will set up Pluto support in pages
makedocs(sitename = "MyPackage.jl")Then in any Markdown page:
Here is a **Pluto notebook**:
```@pluto
notebook = "notebooks/intro.jl"
```You can also embed notebooks that are pre-rendered, if they are hosted somewhere else:
```@pluto
pluto_notebookfile = "https://bucket1.pluto.land/n/….jl"
pluto_statefile = "https://bucket1.pluto.land/n/….plutostate"
```See the documentation for the full option reference and a live demo.
DocumenterPluto hooks into Documenter's expansion and build pipelines:
- An
@plutocode block is parsed into aPlutoBlockAST node. - A build step finds all notebooks, runs them using
Pluto (
Pluto.SessionActions.open+Pluto.notebook_to_js+Pluto.pack), and copies the notebook +.plutostateintodocs/build/pluto_notebooks/. - Pluto's frontend
<head>assets are injected globally viaDocumenter.HTMLWriter.RawHTMLHeadContent. - Each
PlutoBlockis rendered as a<script data-pluto-file="launch-parameters">plus a<pluto-editor>placeholder that the frontend hydrates on load.
The design for this package and the required Documenter.jl PRs were made by Fons. The implementation of this package and some of the documentation is generated using AI.