Section 4.4 Configuration
We have mentioned :
rmd_files in SectionΒ 1.3, and there are more (optional) settings you can configure for a book in _bookdown.ymlβ1β
For the
bs4_book() format, the edit, history, and view fields have no effect and similar configuration can be specified with the repo argument of the output function
-
book_filename: the filename of the main Rmd file, i.e., the Rmd file that is merged from all chapters; by default, it is named_main.Rmd. -
delete_merged_file: whether to delete the main Rmd file after the book is successfully rendered. -
before_chapter_script: one or multiple R scripts to be executed before each chapter, e.g., you may want to clear the workspace before compiling each chapter, in which case you can userm(list = ls(all = TRUE))in the R script. -
after_chapter_script: similar tobefore_chapter_script, and the R script is executed after each chapter. -
edit: a link that collaborators can click to edit the Rmd source document of the current page; this was designed primarily for GitHub repositories, since it is easy to edit arbitrary plain-text files on GitHub even in other peopleβs repositories. This link should have%sin it, which will be substituted by the actual Rmd filename for each page. -
rmd_subdir: whether to search for book source Rmd files in subdirectories (by default, only the root directory is searched). This may be either a boolean or list of paths if you want to search for book source Rmd files in a subset of subdirectories. -
include_md: include.mdfiles in search for book source (by default only.Rmdfiles are included). -
output_dir: the output directory of the book (_bookby default); this setting is read and used byrender_book().
Here is a sample
_bookdown.yml:
book_filename: "my-book.Rmd"
delete_merged_file: true
before_chapter_script: ["script1.R", "script2.R"]
after_chapter_script: "script3.R"
view: https://github.com/rstudio/bookdown-demo/blob/master/%s
edit: https://github.com/rstudio/bookdown-demo/edit/master/%s
output_dir: "book-output"
clean: ["my-book.bbl", "R-packages.bib"]
