blob: 84033ba6cb1c99fa2c920b3c40679e7fdff5c641 [file] [log] [blame]
JJ Allaired708ef02016-01-30 14:30:26 -05001% Generated by roxygen2: do not edit by hand
junkkad4b3a162015-03-16 07:49:11 +01002% Please edit documentation in R/revealjs_presentation.R
JJ Allaire2ec40242014-09-15 09:18:39 -04003\name{revealjs_presentation}
4\alias{revealjs_presentation}
5\title{Convert to a reveal.js presentation}
6\usage{
Atsushi Yasumoto7053f452020-02-15 00:08:46 +09007revealjs_presentation(
8 incremental = FALSE,
9 center = FALSE,
10 slide_level = 2,
Christophe Dervieuxaa008e42021-09-23 16:52:37 +020011 toc = FALSE,
12 toc_depth = 3,
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090013 fig_width = 8,
14 fig_height = 6,
15 fig_retina = if (!fig_caption) 2,
16 fig_caption = FALSE,
Marc Kupietzf667b982026-08-08 17:16:28 +020017 self_contained = FALSE,
18 theme = "ids",
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020019 transition = "convex",
20 background_transition = "fade",
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090021 reveal_options = NULL,
Marc Kupietz03dbc5d2026-08-21 15:44:25 +020022 reveal_plugins = c("notes", "search", "menu", "zoom"),
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090023 highlight = "default",
24 mathjax = "default",
25 template = "default",
26 css = NULL,
27 includes = NULL,
28 keep_md = FALSE,
29 lib_dir = NULL,
30 pandoc_args = NULL,
31 extra_dependencies = NULL,
32 md_extensions = NULL,
33 ...
34)
JJ Allaire2ec40242014-09-15 09:18:39 -040035}
36\arguments{
37\item{incremental}{\code{TRUE} to render slide bullets incrementally. Note
38that if you want to reverse the default incremental behavior for an
JJ Allaire29152752016-03-08 15:06:38 -050039individual bullet you can precede it with \code{>}. For example:
Christophe Dervieux37782092023-03-24 17:36:16 +010040\emph{\verb{> - Bullet Text}}. See more in
41\href{https://pandoc.org/MANUAL.html#incremental-lists}{Pandoc's Manual}}
JJ Allaire2ec40242014-09-15 09:18:39 -040042
43\item{center}{\code{TRUE} to vertically center content on slides}
44
JJ Allaire4c178052016-01-30 19:35:39 -050045\item{slide_level}{Level of heading to denote individual slides. If
46\code{slide_level} is 2 (the default), a two-dimensional layout will be
47produced, with level 1 headers building horizontally and level 2 headers
48building vertically. It is not recommended that you use deeper nesting of
49section levels with reveal.js.}
50
Christophe Dervieuxaa008e42021-09-23 16:52:37 +020051\item{toc}{\code{TRUE} to include a table of contents in the output (only
52level 1 headers will be included in the table of contents).}
53
54\item{toc_depth}{Depth of headers to include in table of contents}
55
JJ Allaire2ec40242014-09-15 09:18:39 -040056\item{fig_width}{Default width (in inches) for figures}
57
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090058\item{fig_height}{Default height (in inches) for figures}
JJ Allaire2ec40242014-09-15 09:18:39 -040059
JJ Allaire82a8dee2016-07-12 10:25:36 -040060\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
61currently works for all widely used retina displays). Set to \code{NULL} to
62prevent retina scaling. Note that this will always be \code{NULL} when
63\code{keep_md} is specified (this is because \code{fig_retina} relies on
64outputting HTML directly into the markdown document).}
JJ Allaire2ec40242014-09-15 09:18:39 -040065
66\item{fig_caption}{\code{TRUE} to render figures with captions}
67
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090068\item{self_contained}{Whether to generate a full LaTeX document (\code{TRUE})
69or just the body of a LaTeX document (\code{FALSE}). Note the LaTeX
70document is an intermediate file unless \code{keep_tex = TRUE}.}
JJ Allaire2ec40242014-09-15 09:18:39 -040071
Marc Kupietzb9a8cba2026-08-28 06:51:28 +030072\item{theme}{Visual theme. Defaults to the dedicated IDS corporate design
73theme ("ids"), which is the raison d'être of this package; the stock
74reveal.js themes are available as rarely used alternatives:
75"simple", "dark", "black", "sky", "beige", "serif", "solarized", "blood", "moon", "night", "league", or "white"
76("dark" is an alias for "black").}
JJ Allaire2ec40242014-09-15 09:18:39 -040077
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020078\item{transition}{Slide transition (
79"convex", "fade", "slide", "concave", "zoom", or "none"
80)}
junkkad4b3a162015-03-16 07:49:11 +010081
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020082\item{background_transition}{Slide background-transition (
83"convex", "fade", "slide", "concave", "zoom", or "none"
84)}
JJ Allaire2ec40242014-09-15 09:18:39 -040085
JJ Allaire35c0b492017-02-10 09:30:24 -050086\item{reveal_options}{Additional options to specify for reveal.js (see
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020087\url{https://revealjs.com/config/} for details). Options for plugins can also
88be passed, using plugin name as first level key (e.g \code{list(slideNumber = FALSE, menu = list(number = TRUE))}).}
JJ Allaire37f45b72016-01-30 18:17:45 -050089
JJ Allaire35c0b492017-02-10 09:30:24 -050090\item{reveal_plugins}{Reveal plugins to include. Available plugins include
Marc Kupietz03dbc5d2026-08-21 15:44:25 +020091"notes", "search", "zoom", "chalkboard", and "menu". Defaults to
92\code{c("notes", "search", "menu", "zoom")}; pass \code{NULL} to render without
93any plugins. Note that \code{self_contained} must be set to \code{FALSE} in order
94to use Reveal plugins.}
JJ Allaire82a8dee2016-07-12 10:25:36 -040095
Christophe Dervieux37782092023-03-24 17:36:16 +010096\item{highlight}{Syntax highlighting style passed to Pandoc.
97
98 Supported built-in styles include "default", "tango", "pygments", "kate",
99 "monochrome", "espresso", "zenburn", "haddock", and "breezedark".
100
101 Two custom styles are also included, "arrow", an accessible color scheme,
102 and "rstudio", which mimics the default IDE theme. Alternatively, supply a
103 path to a \samp{.theme} file to use
104 \href{https://pandoc.org/MANUAL.html#syntax-highlighting}{a custom Pandoc
105 style}. Note that custom theme requires Pandoc 2.0+.
106
107 Pass \code{NULL} to prevent syntax highlighting.}
JJ Allaire2ec40242014-09-15 09:18:39 -0400108
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900109\item{mathjax}{Include mathjax. The "default" option uses an https URL from a
110MathJax CDN. The "local" option uses a local version of MathJax (which is
111copied into the output directory). You can pass an alternate URL or pass
112\code{NULL} to exclude MathJax entirely.}
JJ Allaire2ec40242014-09-15 09:18:39 -0400113
JJ Allaire4c178052016-01-30 19:35:39 -0500114\item{template}{Pandoc template to use for rendering. Pass "default" to use
115the rmarkdown package default template; pass \code{NULL} to use pandoc's
116built-in template; pass a path to use a custom template that you've
117created. Note that if you don't use the "default" template then some
118features of \code{revealjs_presentation} won't be available (see the
119Templates section below for more details).}
JJ Allaire2ec40242014-09-15 09:18:39 -0400120
Christophe Dervieux21239cf2021-09-15 15:34:01 +0200121\item{css}{CSS and/or Sass files to include. Files with an extension of .sass
122or .scss are compiled to CSS via \code{sass::sass()}. Also, if \code{theme} is a
123\code{\link[bslib:bs_theme]{bslib::bs_theme()}} object, Sass code may reference the relevant Bootstrap
124Sass variables, functions, mixins, etc.}
JJ Allairefad55232015-10-19 07:47:26 -0400125
JJ Allaire2ec40242014-09-15 09:18:39 -0400126\item{includes}{Named list of additional content to include within the
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900127document (typically created using the \code{\link[rmarkdown]{includes}} function).}
JJ Allaire2ec40242014-09-15 09:18:39 -0400128
129\item{keep_md}{Keep the markdown file generated by knitting.}
130
131\item{lib_dir}{Directory to copy dependent HTML libraries (e.g. jquery,
JJ Allaire091cb122016-02-09 13:04:23 -0500132bootstrap, etc.) into. By default this will be the name of the document with
Marc Kupietzf667b982026-08-08 17:16:28 +0200133\verb{_files} appended to it.}
JJ Allaire2ec40242014-09-15 09:18:39 -0400134
135\item{pandoc_args}{Additional command line options to pass to pandoc}
JJ Allaire8d1c2f42016-01-30 14:56:45 -0500136
JJ Allaire35c0b492017-02-10 09:30:24 -0500137\item{extra_dependencies}{Additional function arguments to pass to the base R
138Markdown HTML output formatter \code{\link[rmarkdown:html_document_base]{rmarkdown::html_document_base()}}.}
JJ Allaire375805c2016-11-15 08:56:43 -0500139
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900140\item{md_extensions}{Markdown extensions to be added or removed from the
Christophe Dervieux37782092023-03-24 17:36:16 +0100141default definition of R Markdown. See the \code{\link[rmarkdown]{rmarkdown_format}} for
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900142additional details.}
143
JJ Allaire8d1c2f42016-01-30 14:56:45 -0500144\item{...}{Ignored}
JJ Allaire2ec40242014-09-15 09:18:39 -0400145}
146\value{
christophe dervieuxd26add32021-09-23 16:55:00 +0200147R Markdown output format to pass to \code{\link[rmarkdown:render]{rmarkdown::render()}}
JJ Allaire2ec40242014-09-15 09:18:39 -0400148}
149\description{
150Format for converting from R Markdown to a reveal.js presentation.
151}
152\details{
JJ Allaire4c178052016-01-30 19:35:39 -0500153In reveal.js presentations you can use level 1 or level 2 headers for slides.
154If you use a mix of level 1 and level 2 headers then a two-dimensional layout
155will be produced, with level 1 headers building horizontally and level 2
156headers building vertically.
JJ Allaire2ec40242014-09-15 09:18:39 -0400157
JJ Allaire4c178052016-01-30 19:35:39 -0500158For additional documentation on using revealjs presentations see
christophe dervieuxd26add32021-09-23 16:55:00 +0200159\url{https://github.com/rstudio/revealjs}
JJ Allaire2ec40242014-09-15 09:18:39 -0400160}
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200161\section{About plugins}{
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300162The plugins \code{notes}, \code{search}, \code{menu} and \code{zoom} are activated by default;
163only \code{chalkboard} is opt-in. Setting \code{reveal_plugins} replaces the default
164set -- pass \code{NULL} to render without any plugins.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200165\subsection{Built-in plugins with reveal.js}{
166\subsection{Zoom}{
167
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300168Activated by default: ALT + Click can be used to zoom on a slide.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200169}
170
171\subsection{Notes}{
172
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300173Activated by default: shows a \href{https://revealjs.com/speaker-view/}{speaker view} in a separated
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200174window. This speaker view contains a timer, current slide, next slide, and
175speaker notes. It also duplicate the window to have presentation mode
176synchronized with main presentation.
177
Christophe Dervieux37782092023-03-24 17:36:16 +0100178Use
179
180\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{::: notes
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200181Content of speaker notes
182:::
183}\if{html}{\out{</div>}}
184
Marc Kupietz6b65c032026-08-25 09:43:28 +0300185to create notes only viewable in presentation mode. Notes placed before
186the first heading are attached to the title slide.
187
188On mobile browsers (touch devices), a button next to the fullscreen
189toggle overlays the current slide with its speaker notes (plus the slide
190title and, if present, the planned time from a timing comment), which is
191useful for practicing a talk on a phone or tablet. It follows along as
192you change slides and only appears if the deck contains notes at all.
Marc Kupietzeaaa2b42026-08-26 09:41:27 +0300193
Marc Kupietz010db0b2026-08-26 09:56:45 +0300194Pressing \code{r} -- or, on touch devices, tapping the list button next to
195the speaker notes button -- toggles a transcript view: a single
196scrollable page containing every slide's content and speaker notes.
197Text-to-speech ("read aloud") browser extensions cannot walk a
198reveal.js deck, since hidden slides are not part of the visible page
199text -- the transcript gives them something they can read from start
200to finish.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200201}
202
Marc Kupietzb066e742026-08-23 09:57:06 +0300203}
204
205\subsection{Slide timing}{
206
207Speaker time can be planned per slide and per speaker by adding a comment
208with a speaker code and the expected duration (in \code{MM:SS}, \code{HH:MM:SS}, or
209plain seconds format) anywhere inside a slide:
210
211\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## My slide title
212
213Some content
214
215<!-- MK 00:30 -->
216}\if{html}{\out{</div>}}
217
218This means Marc Kupietz will need 30 seconds for that slide. For talks
219presented by a single speaker, the speaker code can be omitted:
Marc Kupietz6b65c032026-08-25 09:43:28 +0300220\verb{<!-- 00:30 -->}. Comments placed before the first heading are applied to
221the title slide.
Marc Kupietzb066e742026-08-23 09:57:06 +0300222
223Typically you start from a known total time budget and adjust the
224individual slides to it. You can set this budget yourself with the
225reveal.js \code{totalTime} option (in seconds):
226
227\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{output:
228 revealjs.ids::revealjs_presentation:
229 reveal_options:
230 totalTime: 3600 # one hour
231}\if{html}{\out{</div>}}
232
233During rendering, comments are converted into \code{data-timing} attributes on
234the slides' \verb{<section>} elements (several speakers per slide are summed
235up), and the calculated grand total is passed to reveal.js as the
236\code{totalTime} config value. This activates the pacing timer in the
237\href{https://revealjs.com/speaker-view/}{speaker view}, which shows how you
238are doing relative to your plan. A summary of the total time per speaker
239is printed during rendering. If the document sets \code{totalTime} or
240\code{defaultTiming} itself (via \code{reveal_options}), those take precedence.
241
242The function \code{\link[=slide_timing]{slide_timing()}} computes these totals directly from an
243\code{.Rmd} source file without rendering it.
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300244}
245
246\subsection{Overview slides}{
247
248Like in the original Google Docs slide workflow, a slide titled
249"Overview" or "Überblick" is automatically turned into a table of
250contents: its body content is replaced at presentation time with a
Marc Kupietz24057e52026-08-25 10:51:06 +0300251clickable list of all \verb{#} chapter headings. Adding
252\code{{data-overview-subheadings=true}} to the heading also includes the
253\verb{##} sub-headings below their chapters, laid out in two columns.
Marc Kupietz4eb03202026-08-25 10:58:10 +0300254References and appendix chapters (References/Literatur/
255Literaturverzeichnis/Appendix/Anhang) are left out, together with
256their sub-slides.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200257\subsection{Search}{
258
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300259Activated by default: pressing \code{CTRL + SHIFT + F} shows a search box.
260It will search in the whole presentation, and highlight matched words. The
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200261matches will also be highlighted in overview mode (pressing ESC to see all
262slides in one scrollable view)
263}
264
265}
266
267\subsection{Menu}{
268
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300269Activated by default: a slideout menu plugin for Reveal.js to quickly jump
270to any slide by title.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200271
Christophe Dervieux37782092023-03-24 17:36:16 +0100272Version is
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200273currently used and documentation for configurations can be found at
274\href{https://github.com/denehyg/reveal.js-menu/blob/2.1.0/README.md}{denehyg/reveal.js-menu}
275\subsection{Known limitations}{
276
277Some configurations cannot be modified in the current template:
278\itemize{
279\item \code{loadIcons: false} the fontawesome icons are loaded by \pkg{rmarkdown}
280when this plugin is used
281\item \code{custom: false}
282\item \code{themes: false}
283\item \code{transitions: false}
284}
285}
286
287}
288
289\subsection{Chalkboard}{
290
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300291An opt-in plugin adding a chalkboard and slide annotation
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200292
Christophe Dervieux37782092023-03-24 17:36:16 +0100293Version is
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200294currently used and documentation for configurations can be found at
Marc Kupietzf667b982026-08-08 17:16:28 +0200295\href{https://github.com/rajgoel/reveal.js-plugins/tree/4.2.5/4.1.5/chalkboard}{rajgoel/reveal.js-plugins}
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200296
297By default, chalkboard and annotations modes will be accessible using keyboard
298shortcuts, respectively, pressing B, or pressing C.
Christophe Dervieux37782092023-03-24 17:36:16 +0100299In addition, buttons on the bottom left can be added by using the following
300
301\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{reveal_plugins:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200302 - chalkboard
303reveal_options:
304 chalkboard:
305 toggleNotesButton: true
306 toggleChalkboardButton: true
307}\if{html}{\out{</div>}}
308}
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300309
310\subsection{Bibliography and citations}{
311
312Documents with a \verb{bibliography:} in their YAML header are formatted with
313the bundled IDS citation style (\code{ids.csl}, based on the style developed
314for ICLC-10 2023 in Mannheim) by default. To use a different style,
315specify it as usual with \verb{csl:} in the YAML header.
316}
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200317}
318
JJ Allaire2ec40242014-09-15 09:18:39 -0400319\examples{
320\dontrun{
321
322library(rmarkdown)
Marc Kupietz03dbc5d2026-08-21 15:44:25 +0200323library(revealjs.ids)
JJ Allaire2ec40242014-09-15 09:18:39 -0400324
325# simple invocation
326render("pres.Rmd", revealjs_presentation())
327
328# specify an option for incremental rendering
329render("pres.Rmd", revealjs_presentation(incremental = TRUE))
330}
JJ Allaired708ef02016-01-30 14:30:26 -0500331
JJ Allaire2ec40242014-09-15 09:18:39 -0400332}