HTML Output Formats and Templates for 'rmarkdown' Documents

HTML formats and templates for 'rmarkdown' documents, with some extra features such as automatic table of contents, lightboxed figures, dynamic crosstab helper.

Travis-CI Build Status CRAN_Status_Badge CRAN Downloads

This R package provides ready-to-use HTML output formats and templates for RMarkdown documents. The goal is to produce clean documents "out of the box", with or without the RStudio IDE.

Formats gallery

The package provides several HTML output formats. You can click on an image to see a real HTML output sample.

material format

Format taken from the Material design theme for Bootstrap 3. Document is split into pages at each <h1> header, and the table of contents allows an animated navigation between these pages (you can use the cards: false preamble parameter to disable the splitting and display all the cards at once).

readthedown format

Adapted from the corresponding readtheorg theme of the org-html-themes project, fully responsive with dynamic table of contents and collapsible navigation.

html_clean format

Simple and clean template with dynamic table of contents, very similar to the one from the great knitrBootstrap package by Jim Hester.

html_docco format

Simple template, no table of contents. CSS heavily inspired from the default one of the docco project.

Features and helpers

Some extra features are available depending on the format :

  • readthedown is fully responsive, with collapsible navigation
  • html_clean and readthedown provide an automatic and dynamic table of contents
  • html_clean and html_docco provide automatic thumbnails for figures with lightbox display
  • code folding and tabsets are supported like in RStudio's HTML template

The package also provides a create.doc() function as well as RStudio document templates to easily generate an empty and ready to use rmarkdown file with several configuration directives.

Finally, it also provides the pilltabs() helper function, which allows to display a crosstab dynamically. See one of the output samples for a live example.


You can install the latest stable release from CRAN :


Or the latest development snapshot from GitHub :

install.packages(remotes)  # if necessary

Creating a new document

Within RStudio

Choose File > New File... > R Markdown..., then select From Template. You should then be able to create a new document from one of the package templates.

Without RStudio

The create.doc() function allows you to create a new directory with a clean ready-to-use RMarkdown file. create.doc() gets two main arguments :

  • dirname is the name of the folder and RMarkdown file to be created
  • format is the format name ("html_clean" or "html_docco")

By default, a Makefile file will be created in the new folder for direct rendering from the command line.


With RStudio

Rendering from within RStudio should be quite simple : just click the Knit button.

Rendering from R

You can render your document into HTML directly from within R with the render() function from the rmarkdown package :


Rendering with the Makefile

If you created your .Rmd file with the create.doc() function, you can then generate HTML or PDF files with :

make html
make pdf

You can also clean out any generated files and cache with :

make clean


  • Magnific popup lightbox plugin
  • The code of create.doc() is heavily inspired by the create.project() function of the ProjectTemplate package
  • The CSS for the html_docco format is heavily inspired from the default one of the docco project.
  • The CSS and JavaScript for readthedown is adapted from the corresponding readtheorg theme of the org-html-themes project, which is itself inspired by the Read the docs Sphinx theme.
  • The CSS and JavaScript for material has been taken from the Material design theme for Bootstrap 3 project and its presentation page
  • JavaScript and HTML code for code folding and tabbed sections are taken from the RStudio's default rmarkdown HTML template

The html_clean styling and features are very similar to the ones from the great knitrBootstrap package by Jim Hester.


rmdformats 0.3.5

  • Fix missing blank line at the end of template.yaml files (thanks @thomaselove)
  • Fix long titles, author and date display in material (thanks @antuki)
  • Fix settings not taken into accounts when using make html (thanks @gdevenyi)

rmdformats 0.3.4

  • Add a cards argument to the material template (thanks @Maiae)
  • Remove deprecated ProjectTemplate templates.
  • Bugfix : lghtbox images do not always fit vertically (thanks @paullemmens)
  • Bugfix : handle toc: false in html_clean (thanks @8steen)
  • Bugfix : add max-width for full images in material (thanks @tyokota)
  • Bugfix : load Rambla Google Webfont via https in docco (thanks @jflycn)
  • Bugfix : do not insert mathjax if mathjax: null in preamble (thanks @jflycn)
  • Bugfix : add description field to template.yml (thanks @mjfrigaard)

rmdformats 0.3.3

  • Bugfix : HTML widgets not displayed in material
  • Better DT::datatable styling
  • Switch Mathjax CDN to cdnjs
  • Bugfix : "Code" hiding/showing dropdown not working anymore in material

rmdformats 0.3.2

  • Bugfix : thumbnails should not upscale images (thanks @dmenne)
  • Bugfix : tab not activated in pilltabs with default HTML template (thanks @dmenne)
  • Bugfix : follow new CRAN policy regarding images in README file

rmdformats 0.3.1

  • Bugfix : Pandoc can't fid tabsets.js (thanks @m-stanley)
  • Bugfix : Incompatibility between dark zenburn and readthedown (thanks Andrey Kostenko)
  • Bugfix : Internal links not working in material (thanks Andrey Kostenko)

rmdformats 0.3

  • New material HTML template
  • New feature : All templates now support code folding and tabsets (thanks @RCura)
  • New feature : lightbox, thumbnails and gallery options for images display (thanks @noamross)
  • New feature : use_bookdown argument for section numbering and cross references (thanks @rdiaz02)
  • html_clean table of contents now uses rmarkdown instead of tocify
  • Bugfix : embedded shiny apps should now work (thanks @mike-powell)
  • Bugfix : wrong styling when no headings (thanks @dmenne)

rmdformats 0.2

  • New readthedown HTML template

rmdformats 0.1.1

  • Cleanup and document package for CRAN submission
  • Copy html_dependency_* and default_mathjax from rmarkdown to fix check notes
  • Add caption to magnific popup
  • HTML formats refactoring : now derived from html_document(), much simpler code

rmdformats 0.0.1

  • First version

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.3 by Julien Barnier, 13 days ago

Report a bug at

Browse source code at

Authors: Julien Barnier [aut, cre]

Documentation:   PDF Manual  

GPL (>= 2) license

Imports knitr, rmarkdown, bookdown, htmltools

Suggests questionr, DT, palmerpenguins, ggplot2

Imported by chronicle.

Suggested by GDAtools, ggRandomForests, idiogramFISH, memoiR, moreparty, seqhandbook, sequenza.

See at CRAN