diff --git a/NEWS.md b/NEWS.md index 3aead75..67a95ba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * flexdashboard now prevents top margin from being applied to boxes created with flexdashboard's markdown syntax when Bootstrap 5 is used. (#443) +* Allow using `theme.preset` without needing to set `theme.bootswatch` to `null`. (#444) + # flexdashboard 0.6.2 ## New features diff --git a/R/bslib.R b/R/bslib.R index e5a522c..77a6778 100644 --- a/R/bslib.R +++ b/R/bslib.R @@ -24,7 +24,13 @@ resolve_theme <- function(theme) { # Default to cosmo theme (just like the non-bslib usage does) # (Users can explictly opt-out with bootswatch: default) if (!is_bs_theme(theme)) { - theme <- utils::modifyList(list(bootswatch = "cosmo"), theme) + theme_default <- list() + # bslib 0.5.1 added the "preset" option, which flexdashboard users may provide + # However, `preset` should not be set with `bootswatch` + if (packageVersion("bslib") < "0.5.1" && !"preset" %in% names(theme)) { + theme_default$bootswatch <- "cosmo" + } + theme <- utils::modifyList(theme_default, theme) theme <- do.call(bs_theme, theme) } # Also default to enable-rounded: true diff --git a/README.md b/README.md index 08ec5ca..6e9b123 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,8 @@ rmarkdown::draft("dashboard.Rmd", There are two main places to get help with flexdashboard: -- The [Posit - community](https://forum.posit.co/tag/flexdashboard) +- The [RStudio + community](https://community.rstudio.com/tags/c/R-Markdown/10/flexdashboard) is a friendly place to ask any questions about flexdashboard. Be sure to use the `flexdashboard` tag. Add also the `shiny` tag is you are using a Shiny runtime. diff --git a/tests/testthat/_snaps/format.md b/tests/testthat/_snaps/format.md index 0c8052b..40ef941 100644 --- a/tests/testthat/_snaps/format.md +++ b/tests/testthat/_snaps/format.md @@ -9,11 +9,11 @@