html_document(toc = FALSE, toc_depth = 3, toc_float = FALSE,
number_sections = FALSE, fig_width = 7, fig_height = 5,
fig_retina = if (!fig_caption) 2, fig_caption = FALSE, dev = "png",
code_folding = c("none", "show", "hide"), smart = TRUE,
self_contained = TRUE, theme = "default", highlight = "default",
mathjax = "default", template = "default", extra_dependencies = NULL,
css = NULL, includes = NULL, keep_md = FALSE, lib_dir = NULL,
md_extensions = NULL, pandoc_args = NULL, ...)
TRUE
to include a table of contents in the outputTRUE
to float the table of contents to the left of the
main document content. Rather than TRUE
you may also pass a list of
options that control the behavior of the floating table of contents. See the
Floating Table of ContentTRUE
to number section headingsfig_caption
is FALSE
, which currently works for all widely
used retina displays). Set to NULL
to prevent retina scaling. Note
that this will always be
TRUE
to render figures with captions"none"
which displays all code chunks (assuming
they were knit with echo = TRUE
). Specify "hide"
to hide all R
code chunks by default (usersNULL
for no theme (in this case you can
use the css
parameter to add NULL
to prevent syntax highlighting.NULL
to exclude MathJNULL
to use pandoc's
built-in template; pass a path to use a custom template that you've created.
Note that if you don't use the "defaulthtml_document_base
includes
function)._files
appended to it.rmarkdown_format
for
additional details.render
toc_float
parameter which
control the behavior of the floating table of contents. Options include:
collapsed
(defaults toTRUE
) controls whether
the table of contents appers with only the top-level (H2) headers. When
collapsed the table of contents is automatically expanded inline when
necessary.smooth_scroll
(defaults to TRUE
) controls
whether page scrolls are animated when table of contents items are navigated
to via mouse clicks..tabset
class
attribute to headers within a document. This will cause all sub-headers of
the header with the .tabset
attribute to appear within tabs rather
than as standalone sections. For example:## Quarterly Results {.tabset}
### By Product
### By Region
You can also specify two additional attributes to control the appearance and
behavior of the tabs. The .tabset-fade
attributes causes the tabs to
fade in and out when switching. The .tabset-pills
attribute causes
the visual appearance of the tabs to be "pill" rather than traditional tabs.
For example:
## Quarterly Results {.tabset .tabset-fade .tabset-pills}
template = NULL
.Note however that if you choose not to use the "default" HTML template then several aspects of HTML document rendering will behave differently:
theme
parameter does not work (you can still
provide styles using thecss
parameter).highlight
parameter, the default highlighting style will resolve to
"pygments" and the "textmate" highlighting style is not availabletoc_float
parameter will not work.code_folding
parameter will not work.self_contained
is
TRUE
(these two options can't be used together in normal pandoc
templates).includes
html_document
format.R Markdown documents can have optional metadata that is used to generate a document header that includes the title, author, and date. For more details see the documentation on R Markdown metadata.
R Markdown documents also support citations. You can find more information on
the markdown syntax for citations in the
library(rmarkdown)
render("input.Rmd", html_document())
render("input.Rmd", html_document(toc = TRUE))
Run the code above in your browser using DataLab