Add run all code cells / autorun
coatless opened this issue · 4 comments
From u/jfcg
on r/Python:
Just a feature request :$ Would it be possible to add a mechanism to run all cells? It could be useful for slides, where one can pre-run everything to avoid delays.
We support this over in quarto-webr
, but not here yet.
I think this was due to the DOM hiccup when loading both Monaco and Pyodide.
If there are multiple code cells in a page, if a user runs each cell in turn, is state propagated from one cell to the next?
eg if cell 1: a=1
does cell 2: print(a)
display 1
or an error?
To answer my own question, the state persists within a page.
Next question to try: if a single .qmd
doc generates several HTML pages, is it possible to (optionally) propagate state across those pages?
The extension treats all code cells as belonging to the same global environment. So, on a given page, defining a variable like a
in cell 1 will cause the variable to be defined and accessible in the later cells (cell 2, cell 3, ...). You can see a demo here:
https://quarto.thecoatlessprofessor.com/pyodide/qpyodide-code-cell-demo.html#strings
Regarding sharing state between pages, that's not possible. Each page gets instantiated through a similar template. So, we can't share the state from Page A with Page B. The closest to "sharing state" would be to allow the other page to source a script in use on the prior page.
Does browser storage work at domain or page level? If domain level, browser storage could be used to hold state that could be dunped from one page into storage then access by another page on load.