Learn R Programming

pensar (version 0.4.2)

vault_export: Static HTML export

Description

Render the vault to a directory of static HTML files. Export the vault to static HTML

Renders every markdown page in the vault to HTML, resolving [[wikilinks]] to relative anchor tags. Output is a standalone site that can be served from any static file server or opened via file://.

The rendered site is regenerable from the vault, so it defaults to the R user cache directory (tools::R_user_dir("pensar", "cache")/site) rather than living inside the vault itself. Pass a different out_dir to override, or set the PENSAR_SITE_DIR environment variable to change the default globally (e.g., point it at a Syncthing folder so edits propagate to other devices on export).

Requires the pandoc command-line tool to be available.

Usage

vault_export(vault = default_vault(), out_dir = default_site_dir())

Value

The output directory path, invisibly.

Arguments

vault

Path to the vault directory.

out_dir

Destination directory. No default: pass an explicit path or set PENSAR_SITE_DIR (per CRAN policy, pensar will not silently render into a home-filespace location).

Examples

Run this code
# \donttest{
if (nzchar(Sys.which("pandoc"))) {
    v <- tempfile("vault-")
    init_vault(v, rproj = FALSE, agent_instructions = FALSE)
    ingest("Body.", type = "articles", source = "demo", vault = v)
    vault_export(v, out_dir = tempfile("site-"))
    unlink(v, recursive = TRUE)
}
# }

Run the code above in your browser using DataLab