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

feat: Adds support for Rmarkdown documents #73

Merged
merged 4 commits into from
Aug 8, 2023
Merged

Conversation

andyquinterom
Copy link
Contributor

@andyquinterom andyquinterom commented Jul 21, 2023

Changes

Closes #45

How to test

These changes allow components that are not inputs or outputs to be rendered in Rmarkdown.

The following example works in a shiny runtime:

library(shiny.react)
library(shiny)
library(shiny.fluent)

ui <- fluentPage(
  ActionButton.shinyInput("nice", PrimaryButton("Nice!"))
)

server <- function(input, output, session) {
  observe({
    print(input$nice)
  })
}

shinyApp(ui, server)

The following works with Rmarkdown:

---
title: "shiny-rmarkdown"
output: html_document
---

```{r, include=FALSE}
library(shiny.fluent)
```

```{r, echo=FALSE}
# This should work!
PrimaryButton("Nice!")
```

```{r, echo=FALSE}
# This should not :(
ActionButton.shinyInput("nice", PrimaryButton("Nice!"))
```

The following is rendered from the Rmarkdown document.
image

@andyquinterom andyquinterom merged commit 6e2e837 into main Aug 8, 2023
1 check passed
@andyquinterom andyquinterom deleted the rmarkdown_support branch August 8, 2023 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support R Markdown
2 participants