Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmarkdown::run with multiple shiny_prerendered documents #2037

Open
3 tasks done
aronatkins opened this issue Feb 8, 2021 · 1 comment
Open
3 tasks done

rmarkdown::run with multiple shiny_prerendered documents #2037

aronatkins opened this issue Feb 8, 2021 · 1 comment
Labels
theme: shiny regarding shiny support in R Markdown document

Comments

@aronatkins
Copy link
Contributor

Using rmarkdown 2.6

Given a directory with multiple Rmd containing runtime: shiny_prerendered, only one of the documents is served by rmarkdown::run. This behavior is different than we see with multiple runtime: shiny documents.

First file (named empty.Rmd):

---
title: "empty.Rmd"
output: html_document
runtime: shiny_prerendered
---

[second](second.Rmd)

```{r, echo=FALSE}
textOutput("message")
```

```{r, context="server"}
output$message <- renderText({
  "This is the empty.Rmd file"
})
```

Second file (named second.Rmd):

---
title: "second.Rmd"
output: html_document
runtime: shiny_prerendered
---

[empty](empty.Rmd)

```{r, echo=FALSE}
textOutput("message")
```

```{r, context="server"}
output$message <- renderText({
  "This is the second.Rmd file"
})
```

Launch the content with:

rmarkdown::run(file=NULL, dir=".")

Only one of the two files is served. In my case, it was always empty.Rmd (the alphabetically first file).

Both documents can be served if you change runtime: shiny_prerendered to runtime: shiny.

The expectations for rmarkdown::run (at least for runtime: shiny documents):

  • http://127.0.0.1:6500/ should serve one of the two applications (based on existing rmarkdown::run rules).
  • http://127.0.0.1:6500/empty.Rmd should serve the empty.Rmd application.
  • http://127.0.0.1:6500/second.Rmd should serve the second.Rmd application.

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv
Copy link
Collaborator

cderv commented Feb 8, 2021

Hi @aronatkins,

I think this is a duplicate of #1576 which I recently asked @schloerke about. It is currently the way prerendered document are working as it will pre render the app UI before running based on one Rmd (or html) file.

Currently, the document to serve at the root url if not provided (default_file) is

  • The Rmd file if there is only one OR
  • index.Rmd or ui.Rmd (first one found) OR
  • First Rmd (alphetically ordered) with a shiny* runtime. OR
  • index.html or ui.html OR
  • the file provided

This logic is the same for both runtime but with prerendered not being able to render according to a new route as with runtime shiny (which render on the run unlike pre rendered). it seems only one Rmd makes sense for shiny prerendered document.

So this is definitly something to look into with the help of the shiny team if we want to support this.

@cderv cderv added the theme: shiny regarding shiny support in R Markdown document label Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: shiny regarding shiny support in R Markdown document
Projects
None yet
Development

No branches or pull requests

2 participants