pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

Updates for bslib > 0.5.1

Open gadenbuie opened this issue 1 year ago • 0 comments

Background

This updates the logic around bslib-provided themes. Two major changes have happened in bslib:

  1. We've added a new "shiny" Bootstrap preset theme, which is now the default for bs_theme() without additional arguments.
  2. As a result, we have superseded bs_theme(bootswatch=) with bs_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:

  1. If no theme is requested, pkgdown will use preset = "default", restoring behavior prior to the new bs_theme() default (in bslib v0.6.0).

    • Fixes #2393
    • Fixes #2376
  2. I added support for template.bslib.preset in addition to (and in front of) template.bootswatch. This could also be named bs_preset or something else entirely if you want.

  3. I renamed get_bslib_theme() and check_bslib_theme() (previously (get,check)_bootswatch_) and I updated check_bslib_theme() to know about all built-in theme presets from bslib.

  4. I moved check_bslib_theme() into get_bslib_theme() so that the error message can report the checked template field but get_bslib_theme() can still return a string theme name.

  5. Finally, when a theme isn't in pkgdown's internal bootswatch_bg list, we now default to "light" to avoid throwing an error.

gadenbuie avatar Feb 12 '24 20:02 gadenbuie