r-wasm / quarto-live

WebAssembly powered code blocks and exercises for both the R and Python languages in Quarto documents
https://r-wasm.github.io/quarto-live/
MIT License
134 stars 10 forks source link

Send to webr editor interaction #51

Open rundel opened 3 months ago

rundel commented 3 months ago

I'm working on updating my slides to use quarto-live for this semester and I've come up with a use case that I'm not sure is possible at the moment (at least without more JS knowledge than I have).

I have a number of slides where there are a bunch of different code examples that I would like the students to be able to experiment with but generally they will only be running one code snippet at a time. Using separate webr blocks for each is inefficient in terms of space used on the slide and makes it pretty much impossible to fit everything.

The feature idea is to be able to have a single webr interactive code block at the bottom of the slide and then have some way of tagging regular code blocks or other text expressions such that when rendered they are proceeded or trailed by a small clickable icon which copies the content into the interactive editor which then can be run by the student. Think a more streamlined version of copy and paste you get with something like this.

Hopefully this idea makes sense, if not I'm happy to try to sketch something out that is more concrete.

georgestagg commented 3 months ago

I think that makes sense, but I will need to think a little about what this will look like for authors in terms of the Quarto syntax to link up regular code cells to live-editor cells.

In any case, this should probably also be made a feature in quarto-drop too. I think it makes even more sense there, because you could click a button to both drop the webR editor down from the top of the slide and copy over the source code into the editor pane for a very smooth experience.