quarto-ext / shinylive

Quarto extension to embed Shinylive for Python applications
https://quarto-ext.github.io/shinylive/
MIT License
141 stars 7 forks source link

Support R Shiny apps #19

Closed georgestagg closed 11 months ago

georgestagg commented 11 months ago

This tweaks the Codeblock handling so that {shinylive-r} type blocks are detected and included in processing.

With this change, el.attributes.engine is set to "python" or "r", depending on the type of Shiny code block. With the changes in the PR at rstudio/shinylive#51, Shinylive is able to read and use this data-attribute to embed the Shiny app into the page using the correct Wasm engine.

Before this can work, the assets installed with shinylive assets must be a version of Shinylive with rstudio/shinylive#51 merged. I've been using shinylive assets install-from-local --source ../shinylive/build/ to install a copy of the assets from my local Shinylive fork.

Demo: https://georgestagg.github.io/quarto-shinylive-demo/

Note: loading webR's Shiny takes a fair while longer than Pyodide's Shiny for Python. See discussion in rstudio/shinylive#51 for my initial thoughts about how to deal with this in the future.