Skip to content

Forward pluto_* args verbatim to launch parameters - #2

Merged
fonsp merged 1 commit into
mainfrom
claude/naughty-dijkstra-fe8be8
Apr 20, 2026
Merged

fonsp merged 1 commit into
mainfrom
claude/naughty-dijkstra-fe8be8

Conversation

@fonsp

@fonsp fonsp commented Apr 20, 2026

Copy link
Copy Markdown
Member

Summary

Redesigns the @pluto block argument syntax. The only recognised special key is now notebook (local .jl file to run). Any other key must start with pluto_ and is forwarded verbatim to the frontend as window.<key> = <value>; in the launch-parameters script.

This removes the hand-picked set of named fields (url, state, binder, disable_ui) and lets users reach any Pluto frontend global without DocumenterPluto growing a field for each one.

Before

```@pluto
url        = "https://example.com/n.jl"
state      = "https://example.com/n.plutostate"
binder     = "https://mybinder.org/…"
disable_ui = false

### After

pluto_notebookfile = "https://example.com/n.jl"
pluto_statefile    = "https://example.com/n.plutostate"
pluto_binder_url   = "https://mybinder.org/…"
pluto_disable_ui   = false

`notebook = "…"` still works for local notebooks; the builder resolves it and emits `pluto_notebookfile`/`pluto_statefile` internally. `pluto_disable_ui` defaults to `true` (unchanged behaviour for docs builds).

## What changed

- `PlutoBlock` now stores `notebook::Union{String,Nothing}` and `pluto_params::Dict{String,Any}` instead of one field per attribute.
- Parser rejects any top-level key that isn't `notebook` or a `pluto_`-prefixed key.
- Validation: either `notebook` is set, or both `pluto_notebookfile` and `pluto_statefile` are set — not both.
- Domify emits every entry of `pluto_params` as `window.<key> = <js>;`. Local-notebook paths overlay `pluto_notebookfile`/`pluto_statefile` via `relhref`. Added a small `_js_value` helper that handles String / Bool / Number / Vector / Dict / nothing.
- Builder loses its pre-hosted-URL branch — for remote notebooks, everything is already sitting in `pluto_params`.

## Test plan

- [x] `Pkg.test()` — all 12 parsing tests pass; the end-to-end test errors on a pre-existing `RawHTMLHeadContent` / `HTMLAsset` version mismatch that also fails on `main`.
- [ ] Spot-check a real docs build with a local notebook and a mix of `pluto_*` overrides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

@fonsp
fonsp force-pushed the claude/naughty-dijkstra-fe8be8 branch from adcdb59 to b12fdf3 Compare April 20, 2026 18:50
Replace the hand-picked `url`/`state`/`binder`/`disable_ui` keys with a
pass-through scheme: the only special key is `notebook` (local .jl to
run), and anything else starting with `pluto_` is emitted verbatim as
`window.<key> = <value>;` in the launch-parameters script. Users can now
reach any Pluto frontend global without DocumenterPluto growing a named
field for each one.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@fonsp
fonsp force-pushed the claude/naughty-dijkstra-fe8be8 branch from b12fdf3 to e1ca044 Compare April 20, 2026 19:16
@fonsp
fonsp merged commit e1a9b38 into main Apr 20, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant