Renders every gallery example with the package itself and writes a self-contained static site. No external site generator, no CDN assets.

build_site(dir, quiet = FALSE, gallery = TRUE, cookbook = TRUE)

Arguments

dir

Output directory (created if needed). There is no default — CRAN policy prohibits writing to the user's home filespace by default, so a path must always be supplied explicitly.

quiet

Suppress progress messages.

Render the gallery figures. Every example is drawn with ggnext itself at build time, which is the bulk of the build cost. Pass FALSE to rewrite the pages without redrawing the figures — useful when iterating on prose, and what makes the example below quick. The pages still build; they simply reference whatever figures are already in dir.

cookbook

Also build the Cookbook page by knitting the worked reference shipped in inst/examples/. Needs the knitr and markdown packages; the page is skipped with a message if either is missing. It renders ~100 plots, so it is the other slow part.

Value

The output directory, invisibly.

Examples

# The figures and the cookbook are the slow parts of a real build; this
# writes the pages only. For the full site, pass a directory of your
# choosing, e.g. build_site("docs").
out <- file.path(tempdir(), "ggnext-site")
build_site(out, quiet = TRUE, gallery = FALSE, cookbook = FALSE)
list.files(out)
#>  [1] "credits.html"            "gallery.html"           
#>  [3] "guide-facets.svg"        "guide-layers.svg"       
#>  [5] "guide-legend.svg"        "guide-polar.svg"        
#>  [7] "guide-positions.svg"     "guide-scales.svg"       
#>  [9] "guide-theming.svg"       "guide.html"             
#> [11] "index.html"              "logo.svg"               
#> [13] "reference.html"          "theme-theme_classic.svg"
#> [15] "theme-theme_dark.svg"    "theme-theme_ggnext.svg" 
#> [17] "theme-theme_minimal.svg" "theme-theme_modern.svg" 
#> [19] "theme-theme_void.svg"    "themes.html"