Adopt the albersdown theme in an existing package.
Arguments
- path
Path to the package directory. Must be supplied explicitly; there is no default so that the function never writes to an unexpected location.
- family
One of
"red","lapis","ochre","teal","green","violet"(case-insensitive). If not given, the family the package already uses is kept: from its vignettes (afamily:stated in theiralbers_vignette()entries, or albersdown 2.0'sparams; the most common if they differ), else from site defaults inpkgdown/extra.jsor_pkgdown.yml, else"red". Withapply_to = "new"the site defaults come first. A message says which was kept and where it came from.- preset
Direction,
"homage"or"interaction"(legacy presets are accepted; case-insensitive). If not given, inferred likefamily, else"homage". Seealbers_presets().- apply_to
"all"to convert the vignettes as well (every*.Rmdinvignettes/; withmethod = "vendor"also*.qmd), or"new"to set up only_pkgdown.yml, the site defaults andDESCRIPTION(vignette dependencies only if a vignette is already on the format).- dry_run
if TRUE, report the changes (including
.Rbuildignoreand.gitignoreentries) without writing anything.- fallback_extra
method = "vendor"only. Controls writing site-wide fallbacks intopkgdown/:"auto": write
pkgdown/extra.cssandpkgdown/extra.jswhenever site-wide defaults are needed."always": always write to
pkgdown/(useful as a safety net or for custom setups)."never": never copy site-wide fallbacks.
With
method = "format", only the site default family is written, topkgdown/extra.js, and only when it is not red/homage (or was set before).- force_replace
method = "vendor"only. If TRUE (default), overwrite existing albersdown assets and replace existing vignette CSS/header hooks so albersdown becomes the active theme.- method
"format"(default) or"vendor"; see Details.- readme
If
TRUE, add a short note about the theme toREADME.Rmd(re-knit it afterwards) or, when there is none,README.md(defaultFALSE), describing the setupmethodmakes.
Details
With method = "format" (the default) each vignettes/*.Rmd whose first
output format is html_vignette is switched to albers_vignette(), and
_pkgdown.yml is pointed at the albersdown template (it is created, and
added to .Rbuildignore with docs/, if missing). DESCRIPTION gains
bbuchsbaum/albersdown in Config/Needs/website. When at least one
vignette is on the format, it also gains albersdown (>= <installed version>) in Suggests (or that bound where albersdown is already in
Imports/Depends), knitr and rmarkdown, and VignetteBuilder: knitr;
and, when the installed albersdown is a development version (not on CRAN),
Remotes: bbuchsbaum/albersdown, so that R CMD check and CI install the
version with albers_vignette() (R CMD check --as-cran notes that
field). Otherwise (no vignettes, none convertible, or apply_to = "new"
with none already on the format) the adoption is site-only and no field that
R CMD check reads is changed. Nothing is copied into
vignettes/. Edits are textual (other output formats, comments, key order
and line endings are kept) and each changed file is backed up to
.albersdown.bak/, which is added to .Rbuildignore and .gitignore.
A package set up by albersdown 2.0 (the vendor setup) is migrated: the
setup-chunk lines and params (family, preset) that 2.0 added are
removed, as are its generated pkgdown/extra.css (an @import of the
theme) and pkgdown/extra.js, and its README note is rewritten. The copied
albers.css, albers.js, albers-header.html and fonts in vignettes/ are
moved to .albersdown.bak/ once no remaining vignette uses them.
Quarto vignettes, flow-style output: {...} headers and pkgdown-only
articles in vignettes/articles/ are listed but not changed: articles take the site default family unless you
set output: albersdown::albers_vignette in their YAML by hand.
With method = "vendor" the stylesheet, script and fonts are copied into
vignettes/ and each vignette keeps rmarkdown::html_vignette with the
theme's css and header include (the albersdown 2.0 setup).
Examples
# \donttest{
if (interactive()) {
use_albersdown(path = ".", dry_run = TRUE)
}
# }