View source: R/build_episode.R
build_episode_md | R Documentation |
This uses knitr::knit()
with custom options set for the Carpentries
template. It runs in a separate process to avoid issues with user-specific
options bleeding in.
build_episode_md(
path,
hash = NULL,
outdir = path_built(path),
workdir = path_built(path),
workenv = globalenv(),
profile = "lesson-requirements",
quiet = FALSE,
error = TRUE
)
path |
path to the RMarkdown file |
hash |
hash to prepend to the output. This parameter is deprecated and is effectively useless. |
outdir |
the directory to write to |
workdir |
the directory where the episode should be rendered |
workenv |
an environment to use for evaluation. Defaults to the global
environment, which evaluates to the environment from |
quiet |
if |
error |
if |
the path to the output, invisibly
this function is for internal use, but exported for those who know what they are doing.
render_html()
, build_episode_html()
if (.Platform$OS.type == "windows") {
options("sandpaper.use_renv" = FALSE)
}
if (!interactive() && getOption("sandpaper.use_renv")) {
old <- renv::config$cache.symlinks()
options(renv.config.cache.symlinks = FALSE)
on.exit(options(renv.config.cache.symlinks = old), add = TRUE)
}
fun_dir <- tempfile()
dir.create(fs::path(fun_dir, "episodes"), recursive = TRUE)
fun_file <- file.path(fun_dir, "episodes", "fun.Rmd")
file.create(fun_file)
txt <- c(
"---\ntitle: Fun times\n---\n\n",
"# new page\n",
"This is coming from `r R.version.string`"
)
writeLines(txt, fun_file)
res <- build_episode_md(fun_file, outdir = fun_dir, workdir = fun_dir)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.