I'm a somewhat experienced R coder, but I have very little knowledge in the HTML world. I've followed the instructions provided here to create a Webr-based Quarto document. It renders the html and runs the code when the html doc is opened in my browser locally.
I would like to integrate these Webr-quarto documents in my university learning page. Could anybody advise how to do this?
I have tried embedding the html output directly, but it does not run and remains "Loading" (screenshot attached).
Code looks like this:
---
title: "webr_exercises"
format: html
engine: knitr
resources:
- webr-serviceworker.js
- webr-worker.js
filters:
- webr
webr:
packages: ['ggplot2', 'dplyr']
---
## Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
```{webr-r}
plot(pressure)
```
I wouldn't recommend using service worker option with webR. (Especially on an LMS.)
Instead, please use
"automatic", which will default into eitherpost-messageorshared-array-buffer(Documentation). The latter communication channel does require header changes regarding how the LMS is serving the document.Next, I would suggest using Quarto HTML's
embed-resourcesoption to directly embedwebr.mjs, Monaco Editor, and FontAwesome that are used by the{quarto-webr}extension.The following Quarto HTML document with these changes should work:
From there, you should be able to upload just the
.htmlfile. Without theembed-resourcesoption, you would need to upload the.htmlfile and the*_filesfolder contents to ensure all resources would be available.For more issues, you may want to raise this as an issue on the project repository:
https://github.com/coatless/quarto-webr/issues