fuse_book {litedown} | R Documentation |
Fuse multiple R Markdown documents to a single output file
Description
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.
Usage
fuse_book(input = ".", output = NULL, envir = parent.frame())
Arguments
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 |
Details
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).
Value
An output file path or the output content, depending on the output
argument.