Learn R Programming

litedown (version 0.11)

fuse_site: Fuse R Markdown documents individually under a directory

Description

Run fuse() on R Markdown documents individually to generate a website.

Usage

fuse_site(input = ".")

Value

Output file paths (invisibly).

Arguments

input

The root directory of the site, or a vector of input file paths.

Details

If a directory contains a config file _litedown.yml, which has a YAML field site, the directory will be recognized as a site root directory. The YAML field output will be applied to all R Markdown files (an individual R Markdown file can provide its own output field in YAML to override the global config). For example:

---
site:
  rebuild: "outdated"
  pattern: "[.]R?md$"
output:
  html:
    meta:
      css: ["@default"]
      include_before: "[Home](/) [About](/about.html)"
      include_after: "© 2024 | [Edit]($input$)"
---

The option rebuild determines whether to rebuild .Rmd files. Possible values are:

  • newfile: Build an input file if it does not have a .html output file.

  • outdated: Rebuild an input file if the modification time of its .html output file is older than the input.

Examples

Run this code
# create a minimal book example in the temp dir
d = tempfile()
litedown:::proj_skeleton(d, "site")
fuse_site(d)
if (interactive()) browseURL(file.path(d, "index.html"))
# clean up
if (xfun::is_R_CMD_check()) unlink(d, recursive = TRUE)

Run the code above in your browser using DataLab