Closed jcheng5 closed 1 year ago
@jcheng5 The implementation should be exactly the same as for Rmd (save for the fact that you definitely can't render). Here is how we implement quarto serve
internally:
Sys.setenv(RMARKDOWN_RUN_PRERENDER = "0")
rmarkdown::run(input, shiny_args = list(host = "127.0.0.1" port = 5555))
@jjallaire If I put the Hello Shiny app at https://quarto.org/docs/interactive/shiny/#hello-shiny into index.qmd and don't prerender, and run this branch as-is, it does seem to render and work correctly (if the R process has permissions to modify the directory). Are you saying we want to explicitly prevent this? (If so--it it because what I've done is actually render it with R Markdown, not Quarto, and it just happened to work because it's a simple document?)
Yes correct, it "worked" by treating it as R Markdown so no Quarto feature will work. It would be a separate feature to support Quarto rendering but I think that is unnecessary
@jjallaire It looks like the way this works is that we call rmarkdown::run(file = NULL, dir = "...")
, and any requests to any of the Shiny rmd/qmd documents in that directory all go to the same R process.
In the (unlikely? or not?) case of a directory containing both .qmd and .rmd files, do you think I should set RMARKDOWN_RUN_PRERENDER=0
?
if there are both then yes set RMARKDOWN_RUN_PRERENDER=0
as the qmd will never work as expected unless you set that.
nice
This PR allows Shiny Server to treat .qmd files the same as .Rmd files. The only difference is that .qmd files only work in prerendered mode; we go out of our way to prevent document rendering from occurring in any directory that contains .qmd.
Testing notes
Using this file:
Expected: Navigating to the subdirectory should produce a simple page with "Link to app"; clicking that link should bring you to a working app.
Scenarios 4-6
Same as above, but use
app_dir
instead ofsite_dir
directive in the SSOS config file.Scenarios 7-9
Same as above, but use
user_dirs
instead ofsite_dir
andlog_dir
directive in the SSOS config file. (As of Shiny Server 1.5.20, this isn't working correctly)