When shinylive is used with embed-resources: true, the original code chunk is shown in full instead of the shinylive app.
So we can add some warning code to the top of the code chunk that only shows up when shinylive fails to load. The top of the code chunk always contains the chunk options, so we need to use the same syntax:
#| '!! shinylive warning !!': |
#| shinylive does not work in self-contained HTML documents.
#| Please set `embed-resources: false` in your metadata.
Hopefully this gives enough information to the person with the broken output to figure out what's going wrong.
Test Document
I put this in `_dev/issues/issue-12/issue-12.qmd`.
````markdown
---
title: "Shinylive with embed-resources: true"
format:
html:
embed-resources: true
filters:
- ../../../_extensions/quarto-ext/shinylive/shinylive.lua
---
```{shinylive-r}
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.R
library(shiny)
ui <- fluidPage(
titlePanel("Hello Shiny!")
)
server <- function(input, output) {
}
# Create Shiny app ----
shinyApp(ui = ui, server = server)
```
````
For #12
When shinylive is used with
embed-resources: true
, the original code chunk is shown in full instead of the shinylive app.So we can add some warning code to the top of the code chunk that only shows up when shinylive fails to load. The top of the code chunk always contains the chunk options, so we need to use the same syntax:
Hopefully this gives enough information to the person with the broken output to figure out what's going wrong.
Test Document
I put this in `_dev/issues/issue-12/issue-12.qmd`. ````markdown --- title: "Shinylive with embed-resources: true" format: html: embed-resources: true filters: - ../../../_extensions/quarto-ext/shinylive/shinylive.lua --- ```{shinylive-r} #| standalone: true #| components: [editor, viewer] #| layout: vertical #| viewerHeight: 400 ## file: app.R library(shiny) ui <- fluidPage( titlePanel("Hello Shiny!") ) server <- function(input, output) { } # Create Shiny app ---- shinyApp(ui = ui, server = server) ``` ````embed-resources: true
embed-resources: false