blob: ce1e0c64755e63f46b43151580c8afd81bba540c [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 Kupietzde3ffa42026-08-30 13:47:57 +0300252\subsection{Chapter numbering}{
253
254Like in the old Google Docs slide workflow, chapter headings (\verb{#}) are
255numbered automatically: the first chapter becomes "1. Introduction", the
256second "2. Methods", and so on. References, appendix and thank-you
257chapters (References/Literatur/Referenzen/Publikationen/
258Herausgeberschaften/Appendix/Anhang, and headings containing
259"Thank you"/"Vielen Dank") keep their bare titles and are not counted.
260Manually typed leading numbers (\verb{# 2. Methods}) are stripped before
261renumbering, so decks migrated from the old pipeline and repeated
262numbering runs stay stable. The numbers are added when the presentation
263is opened: the menu plugin and the transcript view show them, too, and
264the overview slide's table of contents uses them as its ordered list's
265enumeration. Decks rendered with \code{slide_level = 1} (one \verb{#} heading per
266slide) are left unnumbered -- there, headings denote slides, not
267chapters.
268}
269
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300270\subsection{Overview slides}{
271
272Like in the original Google Docs slide workflow, a slide titled
273"Overview" or "Überblick" is automatically turned into a table of
274contents: its body content is replaced at presentation time with a
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300275clickable, ordered list of all \verb{#} chapter headings, whose enumeration
276repeats the chapter numbers. Adding
Marc Kupietz24057e52026-08-25 10:51:06 +0300277\code{{data-overview-subheadings=true}} to the heading also includes the
278\verb{##} sub-headings below their chapters, laid out in two columns.
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300279References, appendix and thank-you chapters (References/Literatur/
280Literaturverzeichnis/Referenzen/Publikationen/Herausgeberschaften/
281Appendix/Anhang, and headings containing "Thank you"/"Vielen Dank") are
282left out, together with their sub-slides.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200283\subsection{Search}{
284
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300285Activated by default: pressing \code{CTRL + SHIFT + F} shows a search box.
286It will search in the whole presentation, and highlight matched words. The
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200287matches will also be highlighted in overview mode (pressing ESC to see all
288slides in one scrollable view)
289}
290
291}
292
293\subsection{Menu}{
294
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300295Activated by default: a slideout menu plugin for Reveal.js to quickly jump
296to any slide by title.
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200297
Christophe Dervieux37782092023-03-24 17:36:16 +0100298Version is
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200299currently used and documentation for configurations can be found at
300\href{https://github.com/denehyg/reveal.js-menu/blob/2.1.0/README.md}{denehyg/reveal.js-menu}
301\subsection{Known limitations}{
302
303Some configurations cannot be modified in the current template:
304\itemize{
305\item \code{loadIcons: false} the fontawesome icons are loaded by \pkg{rmarkdown}
306when this plugin is used
307\item \code{custom: false}
308\item \code{themes: false}
309\item \code{transitions: false}
310}
311}
312
313}
314
315\subsection{Chalkboard}{
316
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300317An opt-in plugin adding a chalkboard and slide annotation
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200318
Christophe Dervieux37782092023-03-24 17:36:16 +0100319Version is
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200320currently used and documentation for configurations can be found at
Marc Kupietzf667b982026-08-08 17:16:28 +0200321\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 +0200322
323By default, chalkboard and annotations modes will be accessible using keyboard
324shortcuts, respectively, pressing B, or pressing C.
Christophe Dervieux37782092023-03-24 17:36:16 +0100325In addition, buttons on the bottom left can be added by using the following
326
327\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{reveal_plugins:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200328 - chalkboard
329reveal_options:
330 chalkboard:
331 toggleNotesButton: true
332 toggleChalkboardButton: true
333}\if{html}{\out{</div>}}
334}
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300335
Marc Kupietz59e95a62026-08-29 10:19:05 +0300336\subsection{Title slide: QR code and additional logos}{
337
338Three optional yaml entries personalise the title slide for external
339audiences (ported from \pkg{posterdown.ids}):
340\itemize{
341\item \verb{website: <url>} -- a linked QR code pointing to the URL is placed in
342the top left of the title slide. Uses the \pkg{qrcode} package.
343\item \verb{partner_logo: <path-or-url>} -- when a presentation is given by
344authors from two institutions, the partner institution's logo is shown
345next to the IDS logo, in the top right of every slide.
346\item \verb{funder_logo: <path-or-url>} -- a funder logo (e.g. "Text+") is placed
347in the bottom left of the title slide, opposite the Leibniz
348Gemeinschaft membership logo. It is lifted above the footer band on
349print (pdf) pages.
350}
351
352Local logo files (svg, png, jpg, gif, webp) are embedded in the html as
353data URIs, so they do not need to be shipped with the presentation; http
354URLs are used as-is. A QR code anywhere else on a slide can be produced
355with \code{\link[=qrlink]{qrlink()}} from inline R code. The navigation chrome (arrows, slide
356number, menu button) is hidden on the title slide for a bare first
357impression.
358}
359
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300360\subsection{Bibliography and citations}{
361
362Documents with a \verb{bibliography:} in their YAML header are formatted with
363the bundled IDS citation style (\code{ids.csl}, based on the style developed
364for ICLC-10 2023 in Mannheim) by default. To use a different style,
365specify it as usual with \verb{csl:} in the YAML header.
366}
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200367}
368
JJ Allaire2ec40242014-09-15 09:18:39 -0400369\examples{
370\dontrun{
371
372library(rmarkdown)
Marc Kupietz03dbc5d2026-08-21 15:44:25 +0200373library(revealjs.ids)
JJ Allaire2ec40242014-09-15 09:18:39 -0400374
375# simple invocation
376render("pres.Rmd", revealjs_presentation())
377
378# specify an option for incremental rendering
379render("pres.Rmd", revealjs_presentation(incremental = TRUE))
380}
JJ Allaired708ef02016-01-30 14:30:26 -0500381
JJ Allaire2ec40242014-09-15 09:18:39 -0400382}