diff --git a/README.md b/README.md index 5964f2a..76b0a87 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Let's dive in! ## Sample App -We'll be walking through the process of creating the following R ShinyLive application. +We'll be walking through the process of creating the following R Shinylive application. ![Example of the Shinylive app running in a Quarto HTML Document](images/demo-r-shinylive-app-inbrowser.gif) @@ -24,7 +24,7 @@ You can see the live version built from the repository here: -# Using r-shinylive for Static Shiny Apps in Quarto Documents +# Using r-shinylive for Serverless Shiny Apps in Quarto Documents Are you interested in creating your own Quarto document with embedded static Shiny apps? This tutorial will guide you through the process of using the `r-shinylive` R package to achieve just that. Let's get started! @@ -76,9 +76,7 @@ filters: - shinylive ``` -**Step 5:** Place your Shiny application code within your Quarto file (`.qmd`) as shown in the following example: - -You can insert the code for a Shiny application in a code block marked with `{shinylive-r}`. Below is a skeletal example of how your code block might look: +**Step 5:** You can insert the code for a Shiny application in a code block marked with `{shinylive-r}`. Below is a skeletal example of how your code block might look: ````md --- @@ -119,7 +117,6 @@ With this in mind, let's use Joe's shiny app inside our code block. So, we'll en #| standalone: true #| viewerHeight: 600 library(shiny) -library(bslib) # Define UI for app that draws a histogram ---- ui <- page_sidebar( @@ -140,8 +137,14 @@ server <- function(input, output, session) { }) output$plot <- renderPlot({ - hist(data(), breaks = 40, xlim = c(-2, 2), ylim = c(0, 1), - lty = "blank", xlab = "value", freq = FALSE, main = "" + hist(data(), + breaks = 40, + xlim = c(-2, 2), + ylim = c(0, 1), + lty = "blank", + xlab = "value", + freq = FALSE, + main = "" ) x <- seq(from = -2, to = 2, length.out = 500) @@ -154,8 +157,10 @@ server <- function(input, output, session) { legend(legend = c("Normal", "Mean", "Sample mean"), col = c("black", "red", "blue"), - lty = c(1, 2, 1), lwd = c(1, lwd, lwd), - x = 1, y = 0.9 + lty = c(1, 2, 1), + lwd = c(1, lwd, lwd), + x = 1, + y = 0.9 ) }, res=140) } @@ -165,10 +170,7 @@ shinyApp(ui = ui, server = server) ``` ```` -You can view a standalone version of Joe's app here: - - - +You can view a standalone version of Joe's app here: [R-shinylive-demo.qmd](https://github.com/coatless-quarto/r-shinylive-demo/blob/main/R-shinylive-demo.qmd) ## Rendering Your Quarto Document diff --git a/index.qmd b/index.qmd index b97cef8..d5737fc 100644 --- a/index.qmd +++ b/index.qmd @@ -18,7 +18,7 @@ For the demo, we're showing the source code used in Joe Cheng's [posit::conf(202 ## Sample Application -We'll be walking through the process of creating the following R ShinyLive application. Please be aware that it may take some time to load. +We'll be walking through the process of creating the following R Shinylive application. Please be aware that it may take some time to load. ```{shinylive-r} #| standalone: true @@ -77,7 +77,7 @@ server <- function(input, output, session) { shinyApp(ui = ui, server = server) ``` -# Tutorial: Using r-shinylive for Static Shiny Apps in Quarto Documents +# Using r-shinylive for Serverless Shiny Apps in Quarto Documents Are you interested in creating your own Quarto document with embedded static Shiny apps? This tutorial will guide you through the process of using the `r-shinylive` R package to achieve just that. Let's get started! @@ -129,9 +129,7 @@ filters: - shinylive ``` -**Step 5:** Place your Shiny application code within your Quarto file (`.qmd`) as shown in the following example: - -You can insert the code for a Shiny application in a code block marked with `{shinylive-r}`. Below is a skeletal example of how your code block might look: +**Step 5:** You can insert the code for a Shiny application in a code block marked with `{shinylive-r}`. Below is a skeletal example of how your code block might look: ````md --- @@ -225,7 +223,7 @@ shinyApp(ui = ui, server = server) ``` ```` -You can view a standalone version of Joe's app here: +You can view a standalone version of Joe's app here: [R-shinylive-demo.qmd](https://github.com/coatless-quarto/r-shinylive-demo/blob/main/R-shinylive-demo.qmd) ## Rendering Your Quarto Document