Automating export of a currently running Pluto notebook to html

I’m interested in automatic generation of html snapshots of a Pluto notebook I’m currently interacting with.

My use case is automatic generation of named html snapshot upon meeting a certain condition, e.g. successful data fit with interactively adjusted parameters. The PlutoSliderServer is therefore not quite suitable.

The intention here is to automate the existing export to html functionality to save a few clicks and avoid typing in new file names.

Is there a way to achieve this from a running Pluto notebook?

2 Likes

Cool question! I think an approach might be to do this from inside your notebook.

You can request the current HTML export contents by making an HTTP request to:

http://localhost:1234/notebookexport?id=....&secret=...

You can manually fill in the ID and Secret (these are different every time that you run the notebook), maybe with PlutoUI.TextField.

With Base.download, you can request the HTML contents and save it. You can use reactivity to do this automatically when you meet certain criteria.

1 Like