Theme R manual pages with roxygen2
@theme tag allows adding CSS and JS files to the HTML version of
the manual pages.
@theme, you need to use the
roxygenlabs_rd roclet. E.g.
add this to
and then use the
@theme tag to add CSS/JS files to all manual pages.
Multiple file names can be specicified in a single
@theme tag, and
file names are relative to the
inst/doc directory, within the package:
#' @theme assets/extra.css assets/rd.js
assets/rd.js files, included in the
package, for an example CSS/JS theme that has the following changes
compared to plain Rd documentation:
R code is syntax-highlighted. This includes R code in the “Usage”
and “Examples” sections, R code created via “r” fences in roxygen’s
markdown, and R code chunks produced by roxygen’s
Add a “Copy” button to R code chunks, to copy them to the clipboard.
Headings have a new style, including a serif font.
More spacious formatting of arguments and list.
Restrict the width of the manual page, to avoid very long lines.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.