R Markdown also comes with several built-in syntax highlighting styles. Supported styles include default
, tango
, pygments
, kate
, monochrome
, espresso
, zenburn
, haddock
, breezedark
, and textmate
. Pass null
to prevent syntax highlighting. To use a highlighter for a single .html file output from a .Rmd file, you edit your YAML:
title: "README.Rmd"
output_format:
html_document:
highlighter: tango
And here is the script to generate the highlighters:
::walk(
purrr.x = as.list(rmarkdown:::highlighters()),
~ rmarkdown::render(
"input/single.Rmd",
output_file = glue::glue("{.}.html"),
output_dir = "gallery/highlighters/",
output_options = list(
toc = TRUE,
toc_float = TRUE,
theme = "cosmo",
code_download = TRUE,
highlight = .x
),params = list(dynamictitle = glue::glue("Texas Housing Prices: `{.}` highlighter"))
) )