| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/html_vignette.R |
| 3 |
\name{html_vignette} |
| 4 |
\alias{html_vignette} |
| 5 |
\title{Convert to an HTML vignette} |
| 6 |
\usage{ |
| 7 |
html_vignette( |
| 8 |
fig_width = 3, |
| 9 |
fig_height = 3, |
| 10 |
dev = "png", |
| 11 |
df_print = "default", |
| 12 |
css = NULL, |
| 13 |
highlight = "pygments", |
| 14 |
keep_md = FALSE, |
| 15 |
readme = FALSE, |
| 16 |
self_contained = TRUE, |
| 17 |
tabset = FALSE, |
| 18 |
code_folding = c("none", "show", "hide"), |
| 19 |
extra_dependencies = NULL, |
| 20 |
pandoc_args = NULL, |
| 21 |
... |
| 22 |
) |
| 23 |
} |
| 24 |
\arguments{ |
| 25 |
\item{fig_width}{Default width (in inches) for figures} |
| 26 |
|
| 27 |
\item{fig_height}{Default height (in inches) for figures} |
| 28 |
|
| 29 |
\item{dev}{Graphics device to use for figure output (defaults to png)} |
| 30 |
|
| 31 |
\item{df_print}{Method to be used for printing data frames. Valid values |
| 32 |
include "default", "kable", "tibble", and "paged". The "default" method |
| 33 |
uses a corresponding S3 method of \code{print}, typically |
| 34 |
\code{print.data.frame}. The "kable" method uses the |
| 35 |
\code{\link[knitr:kable]{knitr::kable}} function. The "tibble" method uses |
| 36 |
the \pkg{tibble} package to print a summary of the data frame. The "paged" |
| 37 |
method creates a paginated HTML table (note that this method is only valid |
| 38 |
for formats that produce HTML). In addition to the named methods you can |
| 39 |
also pass an arbitrary function to be used for printing data frames. You |
| 40 |
can disable the \code{df_print} behavior entirely by setting the option |
| 41 |
\code{rmarkdown.df_print} to \code{FALSE}. See |
| 42 |
\href{https://yihui.org/rmarkdown/html-document.html#data-frame-printing}{Data |
| 43 |
frame printing section} in bookdown book for examples.} |
| 44 |
|
| 45 |
\item{css}{One or more css files to include.} |
| 46 |
|
| 47 |
\item{highlight, ...}{Additional arguments passed to |
| 48 |
\code{\link[=html_document]{html_document()}}. Please note that \code{theme} and |
| 49 |
\code{fig_retina} are hard-coded. Setting any of those will yield an error.} |
| 50 |
|
| 51 |
\item{keep_md}{Keep the markdown file generated by knitting.} |
| 52 |
|
| 53 |
\item{readme}{Use this vignette as the package README.md file (i.e. render |
| 54 |
it as README.md to the package root). Note that if there are image files |
| 55 |
within your vignette you should be sure to add \file{README_files} to \file{.Rbuildignore}.} |
| 56 |
|
| 57 |
\item{self_contained}{Produce a standalone HTML file with no external |
| 58 |
dependencies, using data: URIs to incorporate the contents of linked |
| 59 |
scripts, stylesheets, images, and videos. Note that even for self contained |
| 60 |
documents MathJax is still loaded externally (this is necessary because of |
| 61 |
its size).} |
| 62 |
|
| 63 |
\item{tabset}{Opt-in tabbed-sections feature inspired by \code{\link[=html_document]{html_document()}}. |
| 64 |
See section "Tabbed Sections" for the detail. |
| 65 |
This feature also allows navigation to the tab from table of contents and URL.} |
| 66 |
|
| 67 |
\item{code_folding}{Enable document readers to toggle the display of R code |
| 68 |
chunks. Specify \code{"none"} to display all code chunks. Specify |
| 69 |
\code{"hide"} or \code{"show"} to hide or show all R code chunks by |
| 70 |
default, and let readers toggle the states on browsers. See the |
| 71 |
\emph{Code folding}} |
| 72 |
|
| 73 |
\item{extra_dependencies}{Extra dependencies as a list of the |
| 74 |
\code{html_dependency} class objects typically generated by |
| 75 |
\code{\link[htmltools:htmlDependency]{htmltools::htmlDependency()}}.} |
| 76 |
|
| 77 |
\item{pandoc_args}{Additional command line options to pass to pandoc} |
| 78 |
} |
| 79 |
\value{ |
| 80 |
R Markdown output format to pass to \code{\link[=render]{render()}} |
| 81 |
} |
| 82 |
\description{ |
| 83 |
A HTML vignette is a lightweight alternative to \code{\link[=html_document]{html_document()}} |
| 84 |
suitable for inclusion in packages to be released to CRAN. It reduces the |
| 85 |
size of a basic vignette from 100k to around 10k. |
| 86 |
} |
| 87 |
\details{ |
| 88 |
Compared to \code{\link[=html_document]{html_document()}}, it: |
| 89 |
\itemize{ |
| 90 |
\item never uses retina figures |
| 91 |
\item never uses a theme |
| 92 |
\item has a smaller default figure size |
| 93 |
\item uses a custom css stylesheet |
| 94 |
} |
| 95 |
|
| 96 |
See the \href{https://yihui.org/rmarkdown/r-package-vignette.html}{online documentation} |
| 97 |
for additional details on using the \code{html_vignette()} format. |
| 98 |
} |
| 99 |
\section{Tabbed Sections}{ |
| 100 |
|
| 101 |
|
| 102 |
You can organize content using tabs by applying the \code{.tabset} class |
| 103 |
attribute to headers within a document. This will cause all sub-headers of |
| 104 |
the header with the \code{.tabset} attribute to appear within tabs rather |
| 105 |
than as standalone sections. For example: |
| 106 |
|
| 107 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Quarterly Results \{.tabset\} |
| 108 |
|
| 109 |
### By Product |
| 110 |
|
| 111 |
### By Region |
| 112 |
}\if{html}{\out{</div>}} |
| 113 |
|
| 114 |
With \code{\link[=html_document]{html_document()}}, you can also specify two additional attributes to |
| 115 |
control the appearance and behavior of the tabs. The \code{.tabset-fade} |
| 116 |
attributes causes the tabs to fade in and out when switching. The |
| 117 |
\code{.tabset-pills} attribute causes the visual appearance of the tabs to |
| 118 |
be "pill" rather than traditional tabs. For example: |
| 119 |
|
| 120 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Quarterly Results \{.tabset .tabset-fade .tabset-pills\} |
| 121 |
}\if{html}{\out{</div>}} |
| 122 |
|
| 123 |
If tabbed sections relies on \code{\link[=html_dependency_tabset]{html_dependency_tabset()}}, for example by |
| 124 |
\code{\link[=html_vignette]{html_vignette()}}, these two attributes are not supported. |
| 125 |
} |
| 126 |
|
| 127 |
\section{Code folding}{ |
| 128 |
|
| 129 |
|
| 130 |
Code blocks become foldable by specifying "show" or "hide" to the |
| 131 |
\code{code_folding} parameter. The state can be toggled individually on |
| 132 |
browsers. The document-wide toggle button is also provided for |
| 133 |
\code{html_document} and some of its extensions such as |
| 134 |
\code{html_notebook}. Note that this feature applies not only to source |
| 135 |
codes of chunks, but also markdown code blocks. |
| 136 |
|
| 137 |
Supported languages are R, Python, Bash, SQL, C++, Stan, and Julia. To |
| 138 |
support code blocks with other languages, add \code{foldable} class to them |
| 139 |
(i.e., \code{class.source = "foldable"} as a chunk option). |
| 140 |
|
| 141 |
The default initial state of code folding respects the value given to the |
| 142 |
\code{code_folding} parameter. To override the behavior individually, add |
| 143 |
\code{fold-none} to disable, \code{fold-hide} to initially hide, |
| 144 |
\code{fold-show} to initially show. |
| 145 |
} |
| 146 |
|