rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

Add some guidance to user regarding interactive documents

Open cderv opened this issue 1 year ago • 4 comments

The runtime: shiny vs runtime: shinyrmd distinction is really subtle for someone writing interactive documents.

There are examples where a server.R and ui.Rmd but use runtime: shiny rather than runtime: shinyrmd.

We could add context to rmarkdown::run to understand if the wrong runtime has been specified and guide the user.

Especially:

  • server.R + ui.Rmd should always mean runtime: shinyrmd
  • server: shiny should be used now (instead of runtime: shinyrmd

Adding this note to log and remember this possible improvement.

cderv avatar Jul 24 '24 09:07 cderv

server: shiny should be used now (instead of runtime: shinyrmd)

Why should? (Did you mean "server: shiny_prerendered... instead of... shinyrmd", or maybe some deprecations/changes are coming to prerendering-related technique, or smth. else?)

vpag avatar Jan 09 '25 17:01 vpag

I think what I meant was "should recommend" to avoid confusion. And also because on Quarto side, only server: shiny is supported. https://quarto.org/docs/interactive/shiny/

(Did you mean "server: shiny_prerendered... instead of... shinyrmd"

No I meant server: shiny. server: shiny_prerendered does not exist. runtime: shiny_prerendered is equivalent to runtime: shinyrmd.

All this is just several ways to do things. It was introduced through time and can lead to confusion now.

On rmarkdown side, there is no deprecation. So using runtime: shinyrmd works. However, for document rendered through Quarto, then server: shiny is expected.

What does not for sure is using server.R + ui.Rmd and not using server: shiny.

Anyhow, this is documentation improvement mainly.

No change coming.

cderv avatar Jan 10 '25 10:01 cderv

Ok, so that is for code style, I see.

With a bit of misunderstanding of "...only server: shiny is supported" -- I've just got the same html-output for both (server: shiny and runtime: shiny_prerendered) variants with quarto render|serve. Also, as per conditions evaluated at is_shiny_prerendered(), seems like all of those fronmatter options are equivalent for Rmd/qmd, if I'm not missing some case.

And for now, anyway,

On rmarkdown side, there is no deprecation. No change coming.

Superb. Thanks!

vpag avatar Jan 10 '25 20:01 vpag

I've just got the same html-output for both (server: shiny and runtime: shiny_prerendered) variants with quarto render|serve.

Internally code is the same. On Quarto side, we do check only for server and not runtime. So some processing or checks on Quarto code can be missed if you use runtime with Quarto. And we don't document it.

Anyhow, I labelled it documentation issue anyway. Thanks a lot for your question to help us improve!

cderv avatar Jan 14 '25 11:01 cderv