| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/html_notebook.R |
| 3 |
\name{html_notebook} |
| 4 |
\alias{html_notebook} |
| 5 |
\title{Convert to an HTML notebook} |
| 6 |
\usage{ |
| 7 |
html_notebook( |
| 8 |
toc = FALSE, |
| 9 |
toc_depth = 3, |
| 10 |
toc_float = FALSE, |
| 11 |
number_sections = FALSE, |
| 12 |
fig_width = 7, |
| 13 |
fig_height = 5, |
| 14 |
fig_retina = 2, |
| 15 |
fig_caption = TRUE, |
| 16 |
code_folding = "show", |
| 17 |
theme = "default", |
| 18 |
highlight = "textmate", |
| 19 |
highlight_downlit = FALSE, |
| 20 |
math_method = "default", |
| 21 |
mathjax = "default", |
| 22 |
extra_dependencies = NULL, |
| 23 |
css = NULL, |
| 24 |
includes = NULL, |
| 25 |
md_extensions = NULL, |
| 26 |
pandoc_args = NULL, |
| 27 |
output_source = NULL, |
| 28 |
self_contained = TRUE, |
| 29 |
... |
| 30 |
) |
| 31 |
} |
| 32 |
\arguments{ |
| 33 |
\item{toc}{\code{TRUE} to include a table of contents in the output} |
| 34 |
|
| 35 |
\item{toc_depth}{Depth of headers to include in table of contents} |
| 36 |
|
| 37 |
\item{toc_float}{\code{TRUE} to float the table of contents to the left of the |
| 38 |
main document content. Rather than \code{TRUE} you may also pass a list of |
| 39 |
options that control the behavior of the floating table of contents. See the |
| 40 |
\emph{Floating Table of Contents} section below for details.} |
| 41 |
|
| 42 |
\item{number_sections}{\code{TRUE} to number section headings} |
| 43 |
|
| 44 |
\item{fig_width}{Default width (in inches) for figures} |
| 45 |
|
| 46 |
\item{fig_height}{Default height (in inches) for figures} |
| 47 |
|
| 48 |
\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which |
| 49 |
currently works for all widely used retina displays). Set to \code{NULL} to |
| 50 |
prevent retina scaling. Note that this will always be \code{NULL} when |
| 51 |
\code{keep_md} is specified (this is because \code{fig_retina} relies on |
| 52 |
outputting HTML directly into the markdown document).} |
| 53 |
|
| 54 |
\item{fig_caption}{\code{TRUE} to render figures with captions} |
| 55 |
|
| 56 |
\item{code_folding}{Enable document readers to toggle the display of R code |
| 57 |
chunks. Specify \code{"none"} to display all code chunks. Specify |
| 58 |
\code{"hide"} or \code{"show"} to hide or show all R code chunks by |
| 59 |
default, and let readers toggle the states on browsers. See the |
| 60 |
\emph{Code folding}} |
| 61 |
|
| 62 |
\item{theme}{One of the following: |
| 63 |
\itemize{ |
| 64 |
\item A \code{\link[bslib:bs_theme]{bslib::bs_theme()}} object (or a list of \code{\link[bslib:bs_theme]{bslib::bs_theme()}} argument values) |
| 65 |
\itemize{ |
| 66 |
\item Use this option for custom themes using Bootstrap 4 or 3. |
| 67 |
\item In this case, any \code{.scss}/\code{.sass} files provided to the \code{css} |
| 68 |
parameter may utilize the \code{theme}'s underlying Sass utilities |
| 69 |
(e.g., variables, mixins, etc). |
| 70 |
} |
| 71 |
\item \code{NULL} for no theme (i.e., no \code{\link[=html_dependency_bootstrap]{html_dependency_bootstrap()}}). |
| 72 |
\item A character string specifying a \href{https://bootswatch.com/3/}{Bootswatch 3} |
| 73 |
theme name (for backwards-compatibility). |
| 74 |
}} |
| 75 |
|
| 76 |
\item{highlight}{Syntax highlight engine and style. See the |
| 77 |
\emph{Highlighting} section below for details. |
| 78 |
|
| 79 |
"default" (and "textmate") will use highlightjs as syntax highlighting |
| 80 |
engine instead of Pandoc. |
| 81 |
|
| 82 |
Any other value will be passed as Pandoc's highlighting style. Pandoc's |
| 83 |
built-in styles include "tango", "pygments", "kate", "monochrome", |
| 84 |
"espresso", "zenburn", "haddock" and "breezedark". |
| 85 |
|
| 86 |
Two custom styles are also included, "arrow", an accessible color scheme, |
| 87 |
and "rstudio", which mimics the default IDE theme. Alternatively, supply a |
| 88 |
path to a \samp{.theme} to use |
| 89 |
\href{https://pandoc.org/MANUAL.html#syntax-highlighting}{a custom Pandoc style}. Note that custom theme requires Pandoc 2.0+. |
| 90 |
|
| 91 |
Pass \code{NULL} to prevent syntax highlighting.} |
| 92 |
|
| 93 |
\item{highlight_downlit}{\code{TRUE} to use the \pkg{downlit} package as |
| 94 |
syntax highlight engine to highlight inline code and R code chunks |
| 95 |
(including providing hyperlinks to function documentation). The package |
| 96 |
needs to be installed to use this feature. |
| 97 |
|
| 98 |
Only Pandoc color schemes are supported with this engine. With |
| 99 |
\code{highlight = "default"}, it will use the accessible theme called |
| 100 |
"arrow". To learn more about \pkg{downlit} highlighting engine, see |
| 101 |
\url{https://downlit.r-lib.org/}.} |
| 102 |
|
| 103 |
\item{math_method}{Math rendering engine to use. This will define the math method to use with Pandoc. |
| 104 |
\itemize{ |
| 105 |
\item It can be a string for the engine, one of "mathjax", "mathml", "webtex", "katex", "gladtex", or "r-katex" |
| 106 |
or "default" for \code{mathjax}. |
| 107 |
\item It can be a list of |
| 108 |
\itemize{ |
| 109 |
\item \code{engine}: one of |
| 110 |
"mathjax", "mathml", "webtex", "katex", or "gladtex". |
| 111 |
\item \code{url}: A specific url to use with \code{mathjax}, \code{katex} or \code{webtex}. |
| 112 |
Note that for \code{engine = "mathjax"}, \code{url = "local"} will use a local version of MathJax (which is |
| 113 |
copied into the output directory). |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
For example, |
| 118 |
|
| 119 |
\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{output: |
| 120 |
html_document: |
| 121 |
math_method: |
| 122 |
engine: katex |
| 123 |
url: https://cdn.jsdelivr.net/npm/[email protected]/dist/ |
| 124 |
}\if{html}{\out{</div>}} |
| 125 |
|
| 126 |
See \href{https://pandoc.org/MANUAL.html#math-rendering-in-html}{Pandoc's Manual about Math in HTML} for the details |
| 127 |
about Pandoc supported methods. |
| 128 |
|
| 129 |
Using \code{math_method = "r-katex"} will opt-in server side rendering using |
| 130 |
KaTeX thanks to \href{https://docs.ropensci.org/katex/}{katex} R package. This is |
| 131 |
useful compared to \code{math_method = "katex"} to have no JS dependency, only a |
| 132 |
CSS dependency for styling equation.} |
| 133 |
|
| 134 |
\item{mathjax}{Include mathjax. The "default" option uses an https URL from a |
| 135 |
MathJax CDN. The "local" option uses a local version of MathJax (which is |
| 136 |
copied into the output directory). You can pass an alternate URL or pass |
| 137 |
\code{NULL} to exclude MathJax entirely.} |
| 138 |
|
| 139 |
\item{extra_dependencies}{Extra dependencies as a list of the |
| 140 |
\code{html_dependency} class objects typically generated by |
| 141 |
\code{\link[htmltools:htmlDependency]{htmltools::htmlDependency()}}.} |
| 142 |
|
| 143 |
\item{css}{CSS and/or Sass files to include. Files with an extension of .sass |
| 144 |
or .scss are compiled to CSS via \code{sass::sass()}. Also, if \code{theme} is a |
| 145 |
\code{\link[bslib:bs_theme]{bslib::bs_theme()}} object, Sass code may reference the relevant Bootstrap |
| 146 |
Sass variables, functions, mixins, etc.} |
| 147 |
|
| 148 |
\item{includes}{Named list of additional content to include within the |
| 149 |
document (typically created using the \code{\link{includes}} function).} |
| 150 |
|
| 151 |
\item{md_extensions}{Markdown extensions to be added or removed from the |
| 152 |
default definition of R Markdown. See the \code{\link{rmarkdown_format}} for |
| 153 |
additional details.} |
| 154 |
|
| 155 |
\item{pandoc_args}{Additional command line options to pass to pandoc} |
| 156 |
|
| 157 |
\item{output_source}{Define an output source for \R chunks (ie, |
| 158 |
outputs to use instead of those produced by evaluating the |
| 159 |
underlying \R code). See \code{\link{html_notebook_output}} for |
| 160 |
more details.} |
| 161 |
|
| 162 |
\item{self_contained}{Produce a standalone HTML file with no external |
| 163 |
dependencies. Defaults to \code{TRUE}. In notebooks, setting this to |
| 164 |
\code{FALSE} is not recommended, since the setting does not apply to |
| 165 |
embedded notebook output such as plots and HTML widgets.} |
| 166 |
|
| 167 |
\item{...}{Additional function arguments to pass to the base R Markdown HTML |
| 168 |
output formatter \code{\link{html_document_base}}} |
| 169 |
} |
| 170 |
\description{ |
| 171 |
Format for converting from R Markdown to an HTML notebook. |
| 172 |
} |
| 173 |
\details{ |
| 174 |
See the \href{https://rmarkdown.rstudio.com/r_notebook_format.html}{online |
| 175 |
documentation} for additional details on using the \code{html_notebook} |
| 176 |
format. |
| 177 |
} |