rstudio / bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
https://rstudio.github.io/bslib/
Other
486 stars 58 forks source link

Real-time theming with rmarkdown #141

Closed wch closed 3 years ago

wch commented 4 years ago

We should make sure that the real-time themer works well with rmarkdown. It would be good if we could just add runtime: shiny and bs_themer() on the page, and then have it return something that users could add in their document.

cpsievert commented 4 years ago

Just added support for dynamic theming with runtime: shiny in https://github.com/rstudio/rmarkdown/pull/1706 with https://github.com/rstudio/rmarkdown/pull/1706/commits/8a23b75c402bf6eb916c22525be6a11b788da9e7

cpsievert commented 4 years ago

And here's a testing app

---
title: "Untitled"
output: 
  html_document:
    theme:
      bg: black
      fg: white
runtime: shiny
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
thematic::thematic_on()
bootstraplib::bs_themer()

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)

Including Plots

You can also embed plots, for example:

renderPlot({
  plot(pressure)
})

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

cpsievert commented 3 years ago

Closing since the infrastructure to make this possible seems to be in place

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue. :raising_hand: Need help? Connect with us on Discord or Posit Community.