2.7 Custom blocks

Custom blocks are often used in technical books to create salient boxes of code and/or narrative that call the reader’s attention. For example, custom blocks may be used to highlight a note or a warning. These can be included in multiple bookdown output formats using Pandoc’s syntax for fenced Div blocks (https://pandoc.org/MANUAL.html#divs-and-spans). Section 9.6 in the R Markdown Cookbook (Xie, Dervieux, and Riederer 2020) for instructions.

The bs4_book() HTML output format includes styling for selected custom blocks; see Section 3.1.2.


Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook.