The following shiny app is intended pass user inputs from the app into a parameterized html quarto document that, when rendered, is downloaded via downloadHandler()
and downloadButton()
. This reproducible example works perfectly when deployed locally, but not when hosted on shinyapps.io. My understanding is that the quarto::quarto_render() call should have permission to write a file on shinyapps.io (it wouldn't be persistent from instance to instance, but that's fine). Does shinyapps.io not support quarto rendering? If not, does it support RMarkdown and would this code be expected to work with the appropriate conversions?
app.R:
library(shiny)
library(quarto)
ui <- fluidPage(
titlePanel("Reproducable Example"),
sidebarLayout(
sidebarPanel(
textInput(inputId = "user.name", label = "User name:"),
br(),
downloadButton(outputId = "report", label = "Generate Report:")
),
mainPanel(
)
)
)
server <- function(input, output) {
output$report <- downloadHandler(
filename = "Reprod_ex.html",
content = function(file) {
quarto::quarto_render("myquarto.qmd",
execute_params = list(username = input$user.name))
file.copy("qmd_output.html", file)
}
)
}
# Run the application
shinyApp(ui = ui, server = server)
myquarto.qmd:
---
format:
html:
toc: false
anchor-sections: false
fig-cap-location: bottom
tbl-cap-location: top
number-sections: false
smooth-scroll: true
self-contained: true
css: my-style.css
output-file: "qmd_output.html"
params:
username: NA
---
# Heading
My name is `r params$username`.
htmlrshinyshinyappsquarto