gitbook: The GitBook output format

View source: R/gitbook.R

gitbookR Documentation

The GitBook output format


This output format function ported a style provided by GitBook ( for R Markdown. To read more about this format, see:


  fig_caption = TRUE,
  number_sections = TRUE,
  self_contained = FALSE,
  anchor_sections = TRUE,
  lib_dir = "libs",
  global_numbering = !number_sections,
  pandoc_args = NULL,
  extra_dependencies = list(),
  template = "default",
  split_by = c("chapter", "chapter+number", "section", "section+number", "rmd", "none"),
  split_bib = TRUE,
  config = list(),
  table_css = TRUE,
  code_folding = c("none", "show", "hide")


fig_caption, number_sections, self_contained, anchor_sections, lib_dir, pandoc_args, code_folding, extra_dependencies, ...

Arguments to be passed to rmarkdown::html_document() (... not including toc, and theme).


If TRUE, number figures and tables globally throughout a document (e.g., Figure 1, Figure 2, ...). If FALSE, number them sequentially within sections (e.g., Figure 1.1, Figure 1.2, ..., Figure 5.1, Figure 5.2, ...). Note that global_numbering = FALSE will not work with number_sections = FALSE because sections are not numbered.


Pandoc template to use for rendering. Pass "default" to use the bookdown default template; pass a path to use a custom template. The default template should be sufficient for most use cases. In case you want to develop a custom template, we highly recommend to start from the default template:


How to name the HTML output files from the book: rmd uses the base filenames of the input Rmd files to create the HTML filenames, e.g. generate ‘chapter1.html’ for ‘chapter1.Rmd’; none means do not split the HTML file (the book will be a single HTML file); chapter means split the file by the first-level headers; section means the second-level headers. For chapter and section, the HTML filenames will be determined by the header ID's, e.g. the filename for the first chapter with a chapter title # Introduction will be ‘introduction.html’; for chapter+number and section+number, the chapter/section numbers will be prepended to the HTML filenames, e.g. ‘1-introduction.html’ and ‘2-1-literature.html’.


Whether to split the bibliography onto separate pages where the citations are actually used.


A list of configuration options for the gitbook style, such as the font/theme settings.


TRUE to load gitbook's default CSS for tables. Choose FALSE to unload and use customized CSS (for example, bootstrap) via the css option. Default is TRUE.

bookdown documentation built on Jan. 18, 2023, 1:06 a.m.