9.2 The rmdformats package

The rmdformats package (Barnier 2022) provides several HTML output formats of unique and attractive styles, including:

  • material: A format based on the Material design theme for Bootstrap 3. With this format, every first-level section will become a separate page. See Figure 9.2 for what this format looks like (“Introduction” and “Including Plots” are two first-level sections).

  • readthedown: It features a sidebar layout. The table of contents is displayed in the sidebar on the left. As you scroll on the page, the current section header will be automatically highlighted (and expanded if necessary) in the sidebar.

  • html_clean: A simple and clean HTML template, with a dynamic table of contents at the top-right of the page.

  • html_docco: A simple template inspired by the Docco project.

Do not forget the rmdformats:: prefix when you use these formats, e.g.,

---
output: rmdformats::material
---
The Material Design theme in the rmdformats package.

FIGURE 9.2: The Material Design theme in the rmdformats package.

These output formats have some additional features such as responsiveness and code folding. Please refer to the GitHub repository of the rmdformats package for more information: https://github.com/juba/rmdformats.

References

Barnier, Julien. 2022. Rmdformats: HTML Output Formats and Templates for Rmarkdown Documents. https://github.com/juba/rmdformats.