Can we access the notebook's state from inside the notebook? #1458
Unanswered
markNZed
asked this question in
Questions about using Pluto
Replies: 1 comment
-
It is technically possible but it is not straightforward at all. I also had another discussion about adding the capability of executing js in notebook programmatically here #1359, but the previously tagged discussion on zulip also had some arguments of why doing so is problematic. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm wondering if notebook metaprogramming is possible from within the same notebook e.g. generating multiple outputs by generating multiple cells. Are there any examples of this being done? Thanks.
It seems I can access the PlutoRunner variable from inside a notebook cell. Perhaps anothe way is to use the Javscript frontend to modify the notebook (I guess this is preferrable). It would be great to see how Javasript embedded in a cell could be used to generate a new cell.
From Javascript console it seems there is editor_state available. I can do something like:
editor_state.cell_inputs_local["6ea4b044-11bb-49ba-8f5c-54f4572925ce"].code = 'md"hello world"'
which updates editor_state but does not update the UI.
Beta Was this translation helpful? Give feedback.
All reactions