| fuse_book | R Documentation |
This is a helper function to fuse() .Rmd files and convert all their
Markdown output to a single output file, which is similar to
bookdown::render_book(), but one major differences is that all HTML output
is written to one file, instead of one HTML file per chapter.
fuse_book(input = ".", output = NULL, envir = parent.frame())
input |
A directory or a vector of file paths. By default, all
|
output |
An output file path or a filename extension (e.g., |
envir |
An environment in which the code is to be evaluated. It can be
accessed via |
If the output format needs to be customized, the settings should be written
in the config file _litedown.yml, e.g.,
---
output:
html:
options:
toc:
depth: 4
latex:
meta:
documentclass: "book"
In addition, you can configure the book via the book field, e.g.,
--- book: new_session: true subdir: false pattern: "[.]R?md$" chapter_before: "Information before a chapter." chapter_after: "This chapter was generated from `$input$`." ---
The option new_session specifies whether to render each input file in the
current R session or a separate new R session; chapter_before and
chapter_after specify text to be added to the beginning and end of each
file, respectively, which accepts some variables (e.g., $input$ is the
current input file path).
An output file path or the output content, depending on the output
argument.
# create a minimal book example in the temp dir
d = tempfile()
litedown:::proj_skeleton(d, "book")
fuse_book(d)
if (interactive()) browseURL(file.path(d, "index.html"))
# clean up
if (xfun::is_R_CMD_check()) unlink(d, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.