Title: | Clean Class-Less 'R Markdown' HTML Documents |
---|---|
Description: | A collection of clean 'R Markdown' HTML document templates using classy-looking classless CSS styles. These documents use a minimal set of dependencies but still look great, making them suitable for use a package vignettes or for sharing results via email. |
Authors: | Garrick Aden-Buie [aut, cre, cph] , Igor Adamenko [ctb, cph] (Author of awsm.css), Alvaro Montoro [ctb, cph] (Author of almond.css), Ruan Martinelli [ctb, cph] (Author of axist.css), Tran Ngoc Tuan Anh [ctb, cph] (Author of bamboo.css), Marco Pontili [ctb, cph] (Author of bullframe.css), Evgeny Orekhov [ctb, cph] (Author of holiday.css), Vincent Dorig [ctb, cph] (Author of latex.css), Yegor Bugayenko [ctb, cph] (Author of tacit and kacit), John Otander [ctb, cph] (Author of splendor, air, retro, modest), Matthew Blode [ctb, cph] (Author of marx), Angelos Chalaris [ctb, cph] (Author of mini.css), Example [ctb, cph] (Author of new.css), David Paulsson [ctb, cph] (Author of no-class), Authors of Pico.css [ctb, cph], Mitesh Shah [ctb, cph] (Author of sakura), Dimitri Nicolas [ctb, cph] (Author of semantic.css), Kev Quirk [ctb, cph] (Author of simple.css), Nate Goldman [ctb, cph] (Author of style.css), Jack Crawford [ctb, cph] (Author of stylize), Caio Gondim [ctb, cph] (Author of superstylin), Bradley Taunt [ctb, cph] (Author of vanilla), Kognise [ctb, cph] (Author of water.css), Curtis McEnroe [ctb, cph] (Author of writ) |
Maintainer: | Garrick Aden-Buie <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1.9000 |
Built: | 2024-11-13 05:44:27 UTC |
Source: | https://github.com/gadenbuie/cleanrmd |
Lists the available themes in cleanrmd
cleanrmd_themes()
cleanrmd_themes()
A character string of available theme names.
cleanrmd includes the following no-class CSS themes:
cleanrmd_themes()
cleanrmd_themes()
Clean HTML documents with R Markdown.
html_document_clean( ..., theme = "no-class", css = NULL, toc = FALSE, toc_depth = 3, title_in_header = TRUE, mathjax = NULL, use_fontawesome = FALSE, fig_width = 10, fig_height = 7, fig_retina = 2, keep_md = FALSE, dev = "png", highlight = "default", pandoc_args = NULL, extra_dependencies = NULL, md_extensions = NULL, self_contained = !is.null(theme) )
html_document_clean( ..., theme = "no-class", css = NULL, toc = FALSE, toc_depth = 3, title_in_header = TRUE, mathjax = NULL, use_fontawesome = FALSE, fig_width = 10, fig_height = 7, fig_retina = 2, keep_md = FALSE, dev = "png", highlight = "default", pandoc_args = NULL, extra_dependencies = NULL, md_extensions = NULL, self_contained = !is.null(theme) )
... |
Additional function arguments to pass to the base R Markdown HTML
output formatter |
theme |
The class-less CSS theme to use, one of |
css |
CSS and/or Sass files to include. Files with an extension of .sass
or .scss are compiled to CSS via |
toc |
|
toc_depth |
Depth of headers to include in table of contents |
title_in_header |
If |
mathjax |
Include mathjax. The "default" option uses an https URL from a
MathJax CDN. The "local" option uses a local version of MathJax (which is
copied into the output directory). You can pass an alternate URL or pass
|
use_fontawesome |
Should links to FontAwesome be included in the HTML
document's |
fig_width |
Default width (in inches) for figures |
fig_height |
Default height (in inches) for figures |
fig_retina |
Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to |
keep_md |
Keep the markdown file generated by knitting. |
dev |
Graphics device to use for figure output (defaults to png) |
highlight |
Syntax highlight engine and style, either a built-in Pandoc
highlighting theme, a theme provided by rmarkdown, or a
prismjs theme (see below). Pass
Pandoc themes. By default, uses Pandoc's highlighting style. Pandoc's built-in styles include "tango", "pygments", "kate", "monochrome", "espresso", "zenburn", "haddock" and "breezedark". Two custom styles are also included, "arrow", an accessible color scheme,
and "rstudio", which mimics the default IDE theme. Alternatively, supply a
path to a Prism themes. To use the prismjs
syntax highlighter, pass one of "prism", "prism-coy", "prism-dark",
"prism-funky", "prism-okaidia", "prism-solarizedlight", "prism-tomorrow",
or "prism-twilight". To use an alternate Prism theme file, pass the URL or
path to the theme's CSS file prefixed with "prism:", e.g.
|
pandoc_args |
Additional command line options to pass to pandoc |
extra_dependencies |
Extra dependencies as a list of the
|
md_extensions |
Markdown extensions to be added or removed from the
default definition of R Markdown. See the |
self_contained |
Produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Note that even for self contained documents MathJax is still loaded externally (this is necessary because of its size). |
An R Markdown output format that can be used with output:
in an
.Rmd
or for use with rmarkdown::render()
.
Note that MathJax is disabled by default to reduce the
overall size of the final document. You can enable MathJax by setting
mathjax = "default"
, see rmarkdown::html_document()
for more options.
use_cleanrmd()
for using cleanrmd themes in places other than in
R Markdown documents
if (interactive()) { html_document_clean() } ## Not run: rmarkdown::render("input.Rmd", html_document_clean()) ## End(Not run)
if (interactive()) { html_document_clean() } ## Not run: rmarkdown::render("input.Rmd", html_document_clean()) ## End(Not run)
Provides a cleanrmd CSS theme using htmltools. You can use this
CSS theme anywhere that HTML dependencies are handled via
htmltools::htmlDependency()
, for example in R Markdown or Quarto documents
or in Shiny apps.
use_cleanrmd(name = NULL) cleanrmd_theme_dependency(name = NULL)
use_cleanrmd(name = NULL) cleanrmd_theme_dependency(name = NULL)
name |
The name of the theme, see |
use_cleanrmd()
returns an htmltools::tagList()
with an
htmltools::htmlDependency()
. cleanrmd_theme_dependency()
returns only
the htmltools::htmlDependency()
.
use_cleanrmd()
: Use a clean CSS theme in the current document or app
(general usage)
cleanrmd_theme_dependency()
: Use a clean CSS theme dependency (advanced usage)
In R Markdown (static or Shiny
prerendered), you should use the html_document_clean()
output format to
use a cleanrmd theme.
--- output: cleanrmd::html_document_clean: theme: NULL # or pick a specific theme self_contained: false ---
You can also use cleanrmd in Quarto documents
or apps (using server: shiny
). You'll need to turn off the themes
provided by Quarto with theme: none
and then call
cleanrmd::use_cleanrmd()
in a code chunk in your document.
--- title: "Untitled" format: html: theme: none #server: shiny --- ```{r cleanrmd, echo=FALSE} cleanrmd::use_cleanrmd("bamboo") ```
In Shiny apps, you'll need to use shiny::basicPage()
rather than
shiny::fluidPage()
. Then call use_cleanrmd()
in your app to use a
cleanrmd theme.
library(shiny) ui <- shiny::basicPage( cleanrmd::use_cleanrmd(), h2("Old Faithful Geyser Data"), sliderInput( "bins", "Number of bins:", min = 1, max = 50, value = 30 ), plotOutput("distPlot") )
page <- htmltools::withTags( main( h2("Small Demo"), p("Clean, simple, classy but class-less:"), ul( li("Works almost anywhere"), li("Small and simple"), li("Easy to extend"), li("Good enough but not perfect") ) ) ) # no styles if (interactive()) { htmltools::browsable(page) } # all clean styles page_clean <- htmltools::tagList(page, use_cleanrmd()) if (interactive()) { htmltools::browsable(page_clean) } # one clean style page_water <- htmltools::tagList(page, use_cleanrmd("water")) if (interactive()) { htmltools::browsable(page_water) } cleanrmd_theme_dependency("bamboo")
page <- htmltools::withTags( main( h2("Small Demo"), p("Clean, simple, classy but class-less:"), ul( li("Works almost anywhere"), li("Small and simple"), li("Easy to extend"), li("Good enough but not perfect") ) ) ) # no styles if (interactive()) { htmltools::browsable(page) } # all clean styles page_clean <- htmltools::tagList(page, use_cleanrmd()) if (interactive()) { htmltools::browsable(page_clean) } # one clean style page_water <- htmltools::tagList(page, use_cleanrmd("water")) if (interactive()) { htmltools::browsable(page_water) } cleanrmd_theme_dependency("bamboo")