blob: 274176527233ec05dca710ba65d775e1e38a35f2 [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",
Marc Kupietz725acd12026-08-28 14:03:21 +030024 df_print = "kable",
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090025 mathjax = "default",
26 template = "default",
27 css = NULL,
28 includes = NULL,
29 keep_md = FALSE,
30 lib_dir = NULL,
31 pandoc_args = NULL,
32 extra_dependencies = NULL,
33 md_extensions = NULL,
34 ...
35)
JJ Allaire2ec40242014-09-15 09:18:39 -040036}
37\arguments{
38\item{incremental}{\code{TRUE} to render slide bullets incrementally. Note
39that if you want to reverse the default incremental behavior for an
JJ Allaire29152752016-03-08 15:06:38 -050040individual bullet you can precede it with \code{>}. For example:
Christophe Dervieux37782092023-03-24 17:36:16 +010041\emph{\verb{> - Bullet Text}}. See more in
42\href{https://pandoc.org/MANUAL.html#incremental-lists}{Pandoc's Manual}}
JJ Allaire2ec40242014-09-15 09:18:39 -040043
44\item{center}{\code{TRUE} to vertically center content on slides}
45
JJ Allaire4c178052016-01-30 19:35:39 -050046\item{slide_level}{Level of heading to denote individual slides. If
47\code{slide_level} is 2 (the default), a two-dimensional layout will be
48produced, with level 1 headers building horizontally and level 2 headers
49building vertically. It is not recommended that you use deeper nesting of
50section levels with reveal.js.}
51
Christophe Dervieuxaa008e42021-09-23 16:52:37 +020052\item{toc}{\code{TRUE} to include a table of contents in the output (only
53level 1 headers will be included in the table of contents).}
54
55\item{toc_depth}{Depth of headers to include in table of contents}
56
JJ Allaire2ec40242014-09-15 09:18:39 -040057\item{fig_width}{Default width (in inches) for figures}
58
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090059\item{fig_height}{Default height (in inches) for figures}
JJ Allaire2ec40242014-09-15 09:18:39 -040060
JJ Allaire82a8dee2016-07-12 10:25:36 -040061\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
62currently works for all widely used retina displays). Set to \code{NULL} to
63prevent retina scaling. Note that this will always be \code{NULL} when
64\code{keep_md} is specified (this is because \code{fig_retina} relies on
65outputting HTML directly into the markdown document).}
JJ Allaire2ec40242014-09-15 09:18:39 -040066
67\item{fig_caption}{\code{TRUE} to render figures with captions}
68
Atsushi Yasumoto7053f452020-02-15 00:08:46 +090069\item{self_contained}{Whether to generate a full LaTeX document (\code{TRUE})
70or just the body of a LaTeX document (\code{FALSE}). Note the LaTeX
71document is an intermediate file unless \code{keep_tex = TRUE}.}
JJ Allaire2ec40242014-09-15 09:18:39 -040072
Marc Kupietz9fdf0f72026-08-28 07:04:25 +030073\item{theme}{Visual theme. The dedicated IDS corporate design theme
74("ids") is the default and the only supported theme.}
JJ Allaire2ec40242014-09-15 09:18:39 -040075
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020076\item{transition}{Slide transition (
77"convex", "fade", "slide", "concave", "zoom", or "none"
78)}
junkkad4b3a162015-03-16 07:49:11 +010079
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020080\item{background_transition}{Slide background-transition (
81"convex", "fade", "slide", "concave", "zoom", or "none"
82)}
JJ Allaire2ec40242014-09-15 09:18:39 -040083
JJ Allaire35c0b492017-02-10 09:30:24 -050084\item{reveal_options}{Additional options to specify for reveal.js (see
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020085\url{https://revealjs.com/config/} for details). Options for plugins can also
86be 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 -050087
JJ Allaire35c0b492017-02-10 09:30:24 -050088\item{reveal_plugins}{Reveal plugins to include. Available plugins include
Marc Kupietz03dbc5d2026-08-21 15:44:25 +020089"notes", "search", "zoom", "chalkboard", and "menu". Defaults to
90\code{c("notes", "search", "menu", "zoom")}; pass \code{NULL} to render without
91any plugins. Note that \code{self_contained} must be set to \code{FALSE} in order
92to use Reveal plugins.}
JJ Allaire82a8dee2016-07-12 10:25:36 -040093
Christophe Dervieux37782092023-03-24 17:36:16 +010094\item{highlight}{Syntax highlighting style passed to Pandoc.
95
96 Supported built-in styles include "default", "tango", "pygments", "kate",
97 "monochrome", "espresso", "zenburn", "haddock", and "breezedark".
98
99 Two custom styles are also included, "arrow", an accessible color scheme,
100 and "rstudio", which mimics the default IDE theme. Alternatively, supply a
101 path to a \samp{.theme} file to use
102 \href{https://pandoc.org/MANUAL.html#syntax-highlighting}{a custom Pandoc
103 style}. Note that custom theme requires Pandoc 2.0+.
104
105 Pass \code{NULL} to prevent syntax highlighting.}
JJ Allaire2ec40242014-09-15 09:18:39 -0400106
Marc Kupietz725acd12026-08-28 14:03:21 +0300107\item{df_print}{Method used to print data frames in the document. The
108default, \code{"kable"}, renders data frames as plain HTML tables styled by
109the presentation theme, so that results look reasonable on slides without
110any extra code. Since \code{"kable"} prints all rows, consider showing only
111\code{head(x)} on slides with many-rowed results. Other supported methods are
112\code{"default"} (plain text output), \code{"tibble"}, and \code{"paged"} (an
113interactive paged table, see \code{\link[rmarkdown:html_document]{rmarkdown::html_document()}}).}
114
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900115\item{mathjax}{Include mathjax. The "default" option uses an https URL from a
116MathJax CDN. The "local" option uses a local version of MathJax (which is
117copied into the output directory). You can pass an alternate URL or pass
118\code{NULL} to exclude MathJax entirely.}
JJ Allaire2ec40242014-09-15 09:18:39 -0400119
JJ Allaire4c178052016-01-30 19:35:39 -0500120\item{template}{Pandoc template to use for rendering. Pass "default" to use
121the rmarkdown package default template; pass \code{NULL} to use pandoc's
122built-in template; pass a path to use a custom template that you've
123created. Note that if you don't use the "default" template then some
124features of \code{revealjs_presentation} won't be available (see the
125Templates section below for more details).}
JJ Allaire2ec40242014-09-15 09:18:39 -0400126
Christophe Dervieux21239cf2021-09-15 15:34:01 +0200127\item{css}{CSS and/or Sass files to include. Files with an extension of .sass
128or .scss are compiled to CSS via \code{sass::sass()}. Also, if \code{theme} is a
129\code{\link[bslib:bs_theme]{bslib::bs_theme()}} object, Sass code may reference the relevant Bootstrap
130Sass variables, functions, mixins, etc.}
JJ Allairefad55232015-10-19 07:47:26 -0400131
JJ Allaire2ec40242014-09-15 09:18:39 -0400132\item{includes}{Named list of additional content to include within the
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900133document (typically created using the \code{\link[rmarkdown]{includes}} function).}
JJ Allaire2ec40242014-09-15 09:18:39 -0400134
135\item{keep_md}{Keep the markdown file generated by knitting.}
136
137\item{lib_dir}{Directory to copy dependent HTML libraries (e.g. jquery,
JJ Allaire091cb122016-02-09 13:04:23 -0500138bootstrap, etc.) into. By default this will be the name of the document with
Marc Kupietzf667b982026-08-08 17:16:28 +0200139\verb{_files} appended to it.}
JJ Allaire2ec40242014-09-15 09:18:39 -0400140
141\item{pandoc_args}{Additional command line options to pass to pandoc}
JJ Allaire8d1c2f42016-01-30 14:56:45 -0500142
JJ Allaire35c0b492017-02-10 09:30:24 -0500143\item{extra_dependencies}{Additional function arguments to pass to the base R
144Markdown HTML output formatter \code{\link[rmarkdown:html_document_base]{rmarkdown::html_document_base()}}.}
JJ Allaire375805c2016-11-15 08:56:43 -0500145
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900146\item{md_extensions}{Markdown extensions to be added or removed from the
Christophe Dervieux37782092023-03-24 17:36:16 +0100147default definition of R Markdown. See the \code{\link[rmarkdown]{rmarkdown_format}} for
Atsushi Yasumoto7053f452020-02-15 00:08:46 +0900148additional details.}
149
JJ Allaire8d1c2f42016-01-30 14:56:45 -0500150\item{...}{Ignored}
JJ Allaire2ec40242014-09-15 09:18:39 -0400151}
152\value{
christophe dervieuxd26add32021-09-23 16:55:00 +0200153R Markdown output format to pass to \code{\link[rmarkdown:render]{rmarkdown::render()}}
JJ Allaire2ec40242014-09-15 09:18:39 -0400154}
155\description{
156Format for converting from R Markdown to a reveal.js presentation.
157}
158\details{
JJ Allaire4c178052016-01-30 19:35:39 -0500159In reveal.js presentations you can use level 1 or level 2 headers for slides.
160If you use a mix of level 1 and level 2 headers then a two-dimensional layout
161will be produced, with level 1 headers building horizontally and level 2
162headers building vertically.
JJ Allaire2ec40242014-09-15 09:18:39 -0400163
JJ Allaire4c178052016-01-30 19:35:39 -0500164For additional documentation on using revealjs presentations see
christophe dervieuxd26add32021-09-23 16:55:00 +0200165\url{https://github.com/rstudio/revealjs}
JJ Allaire2ec40242014-09-15 09:18:39 -0400166}
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200167\section{About plugins}{
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300168The plugins \code{notes}, \code{search}, \code{menu} and \code{zoom} are activated by default;
169only \code{chalkboard} is opt-in. Setting \code{reveal_plugins} replaces the default
170set -- pass \code{NULL} to render without any plugins.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200171\subsection{Built-in plugins with reveal.js}{
172\subsection{Zoom}{
173
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300174Activated by default: ALT + Click can be used to zoom on a slide.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200175}
176
177\subsection{Notes}{
178
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300179Activated by default: shows a \href{https://revealjs.com/speaker-view/}{speaker view} in a separated
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200180window. This speaker view contains a timer, current slide, next slide, and
181speaker notes. It also duplicate the window to have presentation mode
182synchronized with main presentation.
183
Christophe Dervieux37782092023-03-24 17:36:16 +0100184Use
185
186\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{::: notes
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200187Content of speaker notes
188:::
189}\if{html}{\out{</div>}}
190
Marc Kupietz6b65c032026-08-25 09:43:28 +0300191to create notes only viewable in presentation mode. Notes placed before
192the first heading are attached to the title slide.
193
194On mobile browsers (touch devices), a button next to the fullscreen
195toggle overlays the current slide with its speaker notes (plus the slide
196title and, if present, the planned time from a timing comment), which is
197useful for practicing a talk on a phone or tablet. It follows along as
198you change slides and only appears if the deck contains notes at all.
Marc Kupietzeaaa2b42026-08-26 09:41:27 +0300199
Marc Kupietz010db0b2026-08-26 09:56:45 +0300200Pressing \code{r} -- or, on touch devices, tapping the list button next to
201the speaker notes button -- toggles a transcript view: a single
202scrollable page containing every slide's content and speaker notes.
203Text-to-speech ("read aloud") browser extensions cannot walk a
204reveal.js deck, since hidden slides are not part of the visible page
205text -- the transcript gives them something they can read from start
206to finish.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200207}
208
Marc Kupietzb066e742026-08-23 09:57:06 +0300209}
210
211\subsection{Slide timing}{
212
213Speaker time can be planned per slide and per speaker by adding a comment
214with a speaker code and the expected duration (in \code{MM:SS}, \code{HH:MM:SS}, or
215plain seconds format) anywhere inside a slide:
216
217\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## My slide title
218
219Some content
220
221<!-- MK 00:30 -->
222}\if{html}{\out{</div>}}
223
224This means Marc Kupietz will need 30 seconds for that slide. For talks
225presented by a single speaker, the speaker code can be omitted:
Marc Kupietz6b65c032026-08-25 09:43:28 +0300226\verb{<!-- 00:30 -->}. Comments placed before the first heading are applied to
227the title slide.
Marc Kupietzb066e742026-08-23 09:57:06 +0300228
229Typically you start from a known total time budget and adjust the
230individual slides to it. You can set this budget yourself with the
231reveal.js \code{totalTime} option (in seconds):
232
233\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{output:
234 revealjs.ids::revealjs_presentation:
235 reveal_options:
236 totalTime: 3600 # one hour
237}\if{html}{\out{</div>}}
238
239During rendering, comments are converted into \code{data-timing} attributes on
240the slides' \verb{<section>} elements (several speakers per slide are summed
241up), and the calculated grand total is passed to reveal.js as the
242\code{totalTime} config value. This activates the pacing timer in the
243\href{https://revealjs.com/speaker-view/}{speaker view}, which shows how you
244are doing relative to your plan. A summary of the total time per speaker
245is printed during rendering. If the document sets \code{totalTime} or
246\code{defaultTiming} itself (via \code{reveal_options}), those take precedence.
247
248The function \code{\link[=slide_timing]{slide_timing()}} computes these totals directly from an
249\code{.Rmd} source file without rendering it.
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300250}
251
Marc Kupietzde3c6c12026-08-30 14:40:33 +0300252\subsection{Vertical content centering}{
253
254Slides with little content look lost when everything is glued below the
255title bar, while packed slides must start at the top. reveal.js' own
256\code{center} option cannot express this -- it also vertically centers the
257headings. Instead, the body content of each slide (everything after the
258heading block except speaker notes) is grouped and, whenever there is
259free space, centered in the area between the heading and the footer:
260slides that are too packed simply start directly below the heading and
261overflow downwards, exactly as before. Centered content never reaches
262into the footer; content too tall to fit above it may, as it always
263could. Heading-only section-divider slides keep their own centered-title
264layout. No configuration is needed and nothing changes about how slides
265are authored.
266}
267
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300268\subsection{Chapter numbering}{
269
270Like in the old Google Docs slide workflow, chapter headings (\verb{#}) are
271numbered automatically: the first chapter becomes "1. Introduction", the
272second "2. Methods", and so on. References, appendix and thank-you
273chapters (References/Literatur/Referenzen/Publikationen/
274Herausgeberschaften/Appendix/Anhang, and headings containing
275"Thank you"/"Vielen Dank") keep their bare titles and are not counted.
276Manually typed leading numbers (\verb{# 2. Methods}) are stripped before
277renumbering, so decks migrated from the old pipeline and repeated
278numbering runs stay stable. The numbers are added when the presentation
279is opened: the menu plugin and the transcript view show them, too, and
280the overview slide's table of contents uses them as its ordered list's
281enumeration. Decks rendered with \code{slide_level = 1} (one \verb{#} heading per
282slide) are left unnumbered -- there, headings denote slides, not
283chapters.
284}
285
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300286\subsection{Overview slides}{
287
288Like in the original Google Docs slide workflow, a slide titled
289"Overview" or "Überblick" is automatically turned into a table of
290contents: its body content is replaced at presentation time with a
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300291clickable, ordered list of all \verb{#} chapter headings, whose enumeration
292repeats the chapter numbers. Adding
Marc Kupietz24057e52026-08-25 10:51:06 +0300293\code{{data-overview-subheadings=true}} to the heading also includes the
294\verb{##} sub-headings below their chapters, laid out in two columns.
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300295References, appendix and thank-you chapters (References/Literatur/
296Literaturverzeichnis/Referenzen/Publikationen/Herausgeberschaften/
297Appendix/Anhang, and headings containing "Thank you"/"Vielen Dank") are
298left out, together with their sub-slides.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200299\subsection{Search}{
300
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300301Activated by default: pressing \code{CTRL + SHIFT + F} shows a search box.
302It will search in the whole presentation, and highlight matched words. The
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200303matches will also be highlighted in overview mode (pressing ESC to see all
304slides in one scrollable view)
305}
306
307}
308
309\subsection{Menu}{
310
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300311Activated by default: a slideout menu plugin for Reveal.js to quickly jump
312to any slide by title.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200313
Christophe Dervieux37782092023-03-24 17:36:16 +0100314Version is
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200315currently used and documentation for configurations can be found at
316\href{https://github.com/denehyg/reveal.js-menu/blob/2.1.0/README.md}{denehyg/reveal.js-menu}
317\subsection{Known limitations}{
318
319Some configurations cannot be modified in the current template:
320\itemize{
321\item \code{loadIcons: false} the fontawesome icons are loaded by \pkg{rmarkdown}
322when this plugin is used
323\item \code{custom: false}
324\item \code{themes: false}
325\item \code{transitions: false}
326}
327}
328
329}
330
331\subsection{Chalkboard}{
332
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300333An opt-in plugin adding a chalkboard and slide annotation
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200334
Christophe Dervieux37782092023-03-24 17:36:16 +0100335Version is
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200336currently used and documentation for configurations can be found at
Marc Kupietzf667b982026-08-08 17:16:28 +0200337\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 +0200338
339By default, chalkboard and annotations modes will be accessible using keyboard
340shortcuts, respectively, pressing B, or pressing C.
Christophe Dervieux37782092023-03-24 17:36:16 +0100341In addition, buttons on the bottom left can be added by using the following
342
343\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{reveal_plugins:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200344 - chalkboard
345reveal_options:
346 chalkboard:
347 toggleNotesButton: true
348 toggleChalkboardButton: true
349}\if{html}{\out{</div>}}
350}
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300351
Marc Kupietz59e95a62026-08-29 10:19:05 +0300352\subsection{Title slide: QR code and additional logos}{
353
354Three optional yaml entries personalise the title slide for external
355audiences (ported from \pkg{posterdown.ids}):
356\itemize{
357\item \verb{website: <url>} -- a linked QR code pointing to the URL is placed in
358the top left of the title slide. Uses the \pkg{qrcode} package.
359\item \verb{partner_logo: <path-or-url>} -- when a presentation is given by
360authors from two institutions, the partner institution's logo is shown
361next to the IDS logo, in the top right of every slide.
362\item \verb{funder_logo: <path-or-url>} -- a funder logo (e.g. "Text+") is placed
363in the bottom left of the title slide, opposite the Leibniz
364Gemeinschaft membership logo. It is lifted above the footer band on
365print (pdf) pages.
366}
367
368Local logo files (svg, png, jpg, gif, webp) are embedded in the html as
369data URIs, so they do not need to be shipped with the presentation; http
370URLs are used as-is. A QR code anywhere else on a slide can be produced
371with \code{\link[=qrlink]{qrlink()}} from inline R code. The navigation chrome (arrows, slide
372number, menu button) is hidden on the title slide for a bare first
373impression.
374}
375
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300376\subsection{Bibliography and citations}{
377
378Documents with a \verb{bibliography:} in their YAML header are formatted with
379the bundled IDS citation style (\code{ids.csl}, based on the style developed
380for ICLC-10 2023 in Mannheim) by default. To use a different style,
381specify it as usual with \verb{csl:} in the YAML header.
382}
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200383}
384
JJ Allaire2ec40242014-09-15 09:18:39 -0400385\examples{
386\dontrun{
387
388library(rmarkdown)
Marc Kupietz03dbc5d2026-08-21 15:44:25 +0200389library(revealjs.ids)
JJ Allaire2ec40242014-09-15 09:18:39 -0400390
391# simple invocation
392render("pres.Rmd", revealjs_presentation())
393
394# specify an option for incremental rendering
395render("pres.Rmd", revealjs_presentation(incremental = TRUE))
396}
JJ Allaired708ef02016-01-30 14:30:26 -0500397
JJ Allaire2ec40242014-09-15 09:18:39 -0400398}