Generating Quarto reports within shiny apps

It's possible to to display and download RMarkdown files from within shiny apps, as in this example. Unfortunately it doesn't appear that an analogous functionality extends to the rendering of quarto HTML files. I, and I suspect many others, are making the move from RMarkdown to Quarto and it would be nice if Quarto documents could be rendered from a shiny app as well.

As long as there is a working quarto installation in the server executing the shiny app the shiny side of things should work the same. The app simply returns the rendered html file, it is renderer agnostic.

Can you explain what is your specific problem with this?

Thank you for the response! I suppose my problem must that I don't know how to render a quarto document from within an app. I based my code on the linked example which uses a markdown::render() function within the content parameter of the downloadHandler().

Do I need to use quarto::quarto_render() instead? If so, how do I pass the params to the Quarto document if I can't specify them in quarto_render()? How do I specify a new environment in which to render the Quarto document?


Why you think you can't? quarto_render() has the execute_params exactly for that.

I don't understand this last one, can you elaborate?

Again, thank you for your help!

I don't understand this last one, can you elaborate?

In the markdown example, the call is:

rmarkdown::render(input, output_file, params, envir = new.env(parent = globalenv()))

This runs the markdown file in a new environment, separate from the app environment.

(PS, sorry for missing that execute_params option. I should have seen that.)

I can't find a direct reference for this but since the Quarto-CLI renders the document under the hood, in what I believe is a completely separate R session, I don't think this is applicable. Obviously, this is just my own conjecture, but I think you can assume the environment is entirely independent.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.