Skip to content

Quarto vignettes used as articles for pkgdown should benefit from the new renderings mode #249

Open
@cderv

Description

@cderv

I am still unsure if this is a pkgdown thing to support (by post-processing the HTML output) or if we can help with this from Quattro Vignette engines.

I just know that pkgdown support light / dark: https://pkgdown.r-lib.org/articles/customise.html#light-switch
However, a vignette included in the package should maybe behave differently when renderings is set (probably choosing only the first one)

I think the question is:

  • Could we make renderings works for pkgdown article?
  • Could there be a fallback mode to use the vignette also as a CRAN package vignette? However, I believe it is fine to say this is only for articles.
  • Quarto should still have an opt-out for renderings to only select one mode if not existing already. (e.g. what happens if #| renderings: [light, dark] but no light / dark themes are set?)

This is to discuss and brainstorm

pkgdown context

It is using the Bootstrap color mode (https://getbootstrap.com/docs/5.3/customize/color-modes/).

pkgdown does call quarto_render() but they call a minimal version for the output with no theme
https://github.com/r-lib/pkgdown/blob/f950aed41af49c732ba7884d0806c3641a7b94b3/R/build-quarto-articles.R#L124-L141

quarto_format <- function(pkg) {
  list(
    lang = pkg$lang,
    format = list(
      html = list(
        template = system_file("quarto", "template.html", package = "pkgdown"),
        minimal = TRUE,
        theme = "none",
        `html-math-method` = config_math_rendering(pkg),
        `embed-resources` = FALSE,
        `citations-hover` = TRUE,
        `link-citations` = TRUE,
        `section-divs` = TRUE,
        toc = FALSE # pkgdown generates with js
      )
    )
  )
}

Then they handle the rest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions