pkgdown
pkgdown copied to clipboard
Updates for bslib > 0.5.1
Background
This updates the logic around bslib-provided themes. Two major changes have happened in bslib:
- We've added a new "shiny" Bootstrap preset theme, which is now the default for
bs_theme()
without additional arguments. - As a result, we have superseded
bs_theme(bootswatch=)
withbs_theme(preset=)
. For backwards compatibility, both arguments are treated equally but only one may be provided.
Changes
This PR updates pkgdown to adapt to the above:
-
If no theme is requested, pkgdown will use
preset = "default"
, restoring behavior prior to the newbs_theme()
default (in bslib v0.6.0).- Fixes #2393
- Fixes #2376
-
I added support for
template.bslib.preset
in addition to (and in front of)template.bootswatch
. This could also be namedbs_preset
or something else entirely if you want. -
I renamed
get_bslib_theme()
andcheck_bslib_theme()
(previously(get,check)_bootswatch_
) and I updatedcheck_bslib_theme()
to know about all built-in theme presets from bslib. -
I moved
check_bslib_theme()
intoget_bslib_theme()
so that the error message can report the checkedtemplate
field butget_bslib_theme()
can still return a string theme name. -
Finally, when a theme isn't in pkgdown's internal
bootswatch_bg
list, we now default to"light"
to avoid throwing an error.