blob: c0e11802baf66c01a8ce1c1923e7e090db5c08f5 [file] [log] [blame]
JJ Allaire5dc9fe02016-01-30 18:44:51 -05001---
Marc Kupietzfbf254d2023-10-09 15:10:42 +02002title: "R Markdown Format for reveal.js Presentations – Extended by an IDS Mannheim CD Theme"
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +02003output: github_document
JJ Allaire5dc9fe02016-01-30 18:44:51 -05004---
5
christophe dervieux42886a12021-09-16 11:36:01 +02006<!-- badges: start -->
7[![CRAN status](https://www.r-pkg.org/badges/version/revealjs)](https://CRAN.R-project.org/package=revealjs)
Christophe Dervieux7d613ee2023-03-24 17:35:02 +01008[![R-CMD-check](https://github.com/rstudio/revealjs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/revealjs/actions/workflows/R-CMD-check.yaml)
Marc Kupietze195cea2026-08-17 13:17:33 +02009[![reveal.js](https://img.shields.io/badge/reveal.js-`r revealjs.ids:::revealjs_version()`-yellow)](https://github.com/rstudio/revealjs/tree/main/inst/reveal.js-`r revealjs.ids:::revealjs_version()`)
christophe dervieux42886a12021-09-16 11:36:01 +020010<!-- badges: end -->
11
Marc Kupietzfbf254d2023-10-09 15:10:42 +020012## Screenshots
13
Marc Kupietz59e95a62026-08-29 10:19:05 +030014Generated from [examples/ids.Rmd](./examples/ids.Rmd), see live demo [here](http://10.0.1.45/slides/2023-10-08-Revealjs-demo/ids.html). A small starting-point deck is [examples/minimal.Rmd](./examples/minimal.Rmd).
Marc Kupietz2aa80632023-10-09 23:19:46 +020015
Marc Kupietzfbf254d2023-10-09 15:10:42 +020016![title](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/title.png?job=build-job)
17
18![users](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/users.png?job=build-job)
Marc Kupietz4cd43b12026-08-28 14:41:51 +030019![collocates](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/ca.png?job=build-job)
Marc Kupietzfbf254d2023-10-09 15:10:42 +020020
21![references](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/references.png?job=build-job)
22
JJ Allaire5dc9fe02016-01-30 18:44:51 -050023## Overview
24
Marc Kupietze195cea2026-08-17 13:17:33 +020025This repository provides an [R Markdown](http://rmarkdown.rstudio.com) custom format for [reveal.js](https://revealjs.com/) HTML presentations. The packages includes _reveal.js_ library in version `r revealjs.ids:::revealjs_version()`
JJ Allaire5dc9fe02016-01-30 18:44:51 -050026
27You can use this format in R Markdown documents by installing this package as follows:
28
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020029``` r
Marc Kupietze45ed912026-05-04 19:45:29 +020030remotes::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/revealjs")
JJ Allaire5dc9fe02016-01-30 18:44:51 -050031```
32
Marc Kupietz569b9022026-08-28 07:29:16 +030033> **Package renamed — migration note:** This package, the IDS corporate design fork of [rstudio/revealjs](https://github.com/rstudio/revealjs), was called `revealjs` before version 0.9.1.9009 and was renamed to `revealjs.ids` so that it can be installed alongside the upstream package. To migrate existing documents, replace `revealjs::revealjs_presentation` with `revealjs.ids::revealjs_presentation` in the YAML header. (Alternatively, install upstream `revealjs` and keep the old header for documents that should use the upstream format.)
34
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +090035To create a [reveal.js](https://revealjs.com/) presentation from R Markdown you specify the `revealjs_presentation` output format in the front-matter of your document. You can create a slide show broken up into sections by using the `#` and `##` heading tags (you can also create a new slide without a header using a horizontal rule (`----`). For example here's a simple slide show:
JJ Allaire5dc9fe02016-01-30 18:44:51 -050036
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020037``` markdown
38---
39title: "Habits"
40author: John Doe
41date: March 22, 2005
Marc Kupietze195cea2026-08-17 13:17:33 +020042output: revealjs.ids::revealjs_presentation
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020043---
JJ Allaire5dc9fe02016-01-30 18:44:51 -050044
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020045# In the morning
JJ Allaire5dc9fe02016-01-30 18:44:51 -050046
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020047## Getting up
JJ Allaire5dc9fe02016-01-30 18:44:51 -050048
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020049- Turn off alarm
50- Get out of bed
JJ Allaire5dc9fe02016-01-30 18:44:51 -050051
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020052## Breakfast
JJ Allaire5dc9fe02016-01-30 18:44:51 -050053
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020054- Eat eggs
55- Drink coffee
JJ Allaire5dc9fe02016-01-30 18:44:51 -050056
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020057# In the evening
JJ Allaire5dc9fe02016-01-30 18:44:51 -050058
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020059## Dinner
JJ Allaire5dc9fe02016-01-30 18:44:51 -050060
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020061- Eat spaghetti
62- Drink wine
JJ Allaire5dc9fe02016-01-30 18:44:51 -050063
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020064## Going to sleep
JJ Allaire5dc9fe02016-01-30 18:44:51 -050065
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020066- Get in bed
67- Count sheep
68```
JJ Allaire5dc9fe02016-01-30 18:44:51 -050069
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020070## Rendering
Daniel Chen46087c32016-03-21 17:58:14 -040071
Daniel Chen81a14342016-03-21 18:00:56 -040072Depending on your use case, there are 3 ways you can render the presentation.
Daniel Chen46087c32016-03-21 17:58:14 -040073
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200741. RStudio
752. R console
763. Terminal (e.g., bash)
Daniel Chen46087c32016-03-21 17:58:14 -040077
78### RStudio
79
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020080When creating the presentation in RStudio, there will be a `Knit` button right below the source tabs. By default, it will render the current document and place the rendered `HTML` file in the same directory as the source file, with the same name.
Daniel Chen46087c32016-03-21 17:58:14 -040081
82### R Console
83
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020084The `Knit` button is actually calling the `rmarkdown::render()` function. So, to render the document within the R console:
Daniel Chen46087c32016-03-21 17:58:14 -040085
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020086``` r
Daniel Chen46087c32016-03-21 17:58:14 -040087rmarkdown::render('my_reveal_presentation.Rmd')
88```
89
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020090There are many other output tweaks you can use by directly calling `render`. You can read up on the [documentation](https://pkgs.rstudio.com/rmarkdown/reference/render.html) for more details.
Daniel Chen46087c32016-03-21 17:58:14 -040091
92### Command Line
93
94When you need the presentation to be rendered from the command line:
95
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020096``` bash
Daniel Chen46087c32016-03-21 17:58:14 -040097Rscript -e "rmarkdown::render('my_reveal_presentation.Rmd')"
98```
99
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500100## Display Modes
101
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200102The following single character keyboard shortcuts enable alternate display modes:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500103
104- `'f'` enable fullscreen mode
105
106- `'o'` enable overview mode
107
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200108- `'b'` enable pause mode with a black screen hiding slide content
109
110- `'?'` enable help mode to show keyboard shortcut cheatsheet
111
112- `'s'` enable presentation mode with speaker notes when the Notes plugin is activated
113
Marc Kupietz010db0b2026-08-26 09:56:45 +0300114On mobile browsers (touch devices), a speech-bubble button next to the fullscreen button overlays the current slide with its speaker notes -- useful for practicing a talk on a phone or tablet, where the separate speaker view window of the `'s'` shortcut is awkward. The overlay shows the slide title, its planned time (if annotated with a timing comment), and the notes, and follows along as you change slides. It appears only if the deck contains notes at all. Next to it, a list button opens the transcript view (same as pressing `r`), so the whole talk including notes can be read (aloud) on mobile devices, too.
Marc Kupietz88799182026-08-24 09:22:33 +0300115
Marc Kupietzeaaa2b42026-08-26 09:41:27 +0300116- `'r'` toggle the transcript view: a single scrollable page containing every slide's content and speaker notes, so text-to-speech ("read aloud") browser extensions can read the whole presentation -- they cannot walk a reveal.js deck themselves, since hidden slides are not part of the visible page text
117
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200118- `'m'` enable menu mode when the 'menu' plugin is activated
119
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500120Pressing `Esc` exits all of these modes.
121
Marc Kupietzb066e742026-08-23 09:57:06 +0300122## Slide Timing
123
124You can plan the time budget of a talk by adding timing comments to your slides: a comment with an optional speaker code and the expected duration (`MM:SS`, `HH:MM:SS`, or plain seconds), ported from the old Google-Docs-based slide workflow:
125
126``` markdown
127## My slide title
128
129Some content
130
131<!-- JD 00:30 -->
132```
133
Marc Kupietz6b65c032026-08-25 09:43:28 +0300134This means John Doe will need 30 seconds for that slide. For talks presented by a single speaker, the speaker code can be omitted: Comments placed before the first heading are applied to the title slide, so you can give the title itself a time budget and a welcome note:
Marc Kupietzb066e742026-08-23 09:57:06 +0300135
136``` markdown
137## My slide title
138
139Some content
140
141<!-- 00:30 -->
142```
143
144Typically you start from a known total time budget and adjust the individual slides to it. You can set this budget yourself with the `totalTime` option (in seconds):
145
146``` yaml
147output:
148 revealjs.ids::revealjs_presentation:
149 reveal_options:
150 totalTime: 3600 # one hour
151```
152
153When rendering, the comments are converted into [`data-timing` attributes](https://revealjs.com/speaker-view/) on the slides, and the calculated grand total is passed to reveal.js as the `totalTime` config value (unless you set `totalTime` yourself). This activates the pacing timer in the [speaker view](https://revealjs.com/speaker-view/) (press `s`), showing how you are doing relative to your plan. Several speakers per slide are supported, and a summary with the total time per speaker is printed:
154
155```
156Slide timing -- JD: 0:30, AB: 1:00 -- total 1:30
157```
158
159To compute the time budget without rendering the presentation, you can call `slide_timing()` directly on the `.Rmd` source file.
160
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300161## Overview Slides
162
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300163Like in the old Google-Docs-based slide workflow, a slide titled "Overview" or "Überblick" is automatically turned into a table of contents: its body content is replaced with an ordered list of all `#` chapter headings, whose enumeration repeats the chapter numbers, and each entry links to the corresponding slide.
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300164
165``` markdown
166## Overview
167
168(any placeholder content -- replaced automatically)
169```
170
Marc Kupietz4eb03202026-08-25 10:58:10 +0300171To also include the `##` sub-headings below their chapters, add `{data-overview-subheadings=true}` to the heading; the list is then laid out in two columns. References and appendix chapters (References/Literatur/Literaturverzeichnis/Appendix/Anhang) are left out, together with their sub-slides.
Marc Kupietz24057e52026-08-25 10:51:06 +0300172
173``` markdown
174## Overview {data-overview-subheadings=true}
175```
176
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300177The TOC is generated when the presentation is opened, so it always reflects the deck it is part of. Slides without a heading and the title slide are left out.
178
Marc Kupietzde3ffa42026-08-30 13:47:57 +0300179## Chapter Numbering
180
181Like in the old Google-Docs-based slide workflow, `#` chapter headings are numbered automatically when the presentation is opened: the first chapter becomes "1. Introduction", the second "2. Methods", and so on. References, appendix and thank-you chapters (References/Literatur/Referenzen/Publikationen/Herausgeberschaften/Appendix/Anhang, and headings containing "Thank you"/"Vielen Dank") keep their bare titles and are not counted. Manually typed leading numbers (`# 2. Methods`) are stripped before renumbering, so the numbering also comes out right in decks migrated from the old pipeline. Since the numbers are added to the headings themselves, they show up everywhere the headings do: the menu plugin and the transcript view, and on the overview slide they become the enumeration of the table of contents.
182
183Decks with `slide_level: 1` (one `#` heading per slide) are left unnumbered -- there, headings denote slides, not chapters.
184
Marc Kupietz499082c2026-08-30 15:26:44 +0300185The numbering can be turned off with the `chapter_numbering` option -- headings then keep exactly what was typed:
186
187``` yaml
188output:
189 revealjs.ids::revealjs_presentation:
190 chapter_numbering: false
191```
192
193A number starts the enumeration at that value instead, which is useful for continuation decks:
194
195``` yaml
196output:
197 revealjs.ids::revealjs_presentation:
198 chapter_numbering: 5
199```
200
Marc Kupietzde3c6c12026-08-30 14:40:33 +0300201## Vertical Content Centering
202
203Slides with little content no longer sit glued below the title bar: whenever there is free space, the slide's body content is centered in the area between the heading and the footer. Slides that are too packed start directly below the heading and overflow downwards exactly as before, and centered content never covers the footer. Reveal.js' own `center` option could not be used for this, because it also vertically centers the headings. Heading-only section-divider slides keep their dedicated centered-title layout.
204
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500205## Incremental Bullets
206
207You can render bullets incrementally by adding the `incremental` option:
208
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200209``` yaml
210---
211output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200212 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200213 incremental: true
214---
215```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500216
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200217If you want to render bullets incrementally for some slides but not others you can use this syntax:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500218
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200219``` markdown
220::: incremental
221
222- Eat spaghetti
223- Drink wine
224
225:::
226```
227
228or
229
230``` markdown
231::: nonincremental
232
233- Eat spaghetti
234- Drink wine
235
236:::
237```
238
239## Incremental Revealing
240
241You can also add pauses between content on a slide using `. . .`
242
243``` markdown
244# Slide header
245
246Content shown first
247
248. . .
249
250Content shown next on the same slide
251```
252
253Using Fragments explicitly is also possible
254
255``` markdown
256# Slide header
257
258Content shown first
259
260::: fragment
261Content shown next on the same slide
262:::
263```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500264
265## Appearance and Style
266
267There are several options that control the appearance of revealjs presentations:
268
Marc Kupietz9fdf0f72026-08-28 07:04:25 +0300269- `theme` specifies the visual theme for the presentation. The dedicated IDS corporate design theme (`"ids"`) is the default and the only supported theme.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500270
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200271- `highlight` specifies the syntax highlighting style. Supported styles include `r knitr::combine_words(rmarkdown:::highlighters(), before = '"', and = " or ")`. Pass null to prevent syntax highlighting.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500272
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200273- `center` specifies whether you want to vertically center content on slides (this defaults to false).
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500274
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500275For example:
276
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200277``` yaml
278output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200279 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200280 highlight: pygments
281 center: true
282```
283
Marc Kupietz59e95a62026-08-29 10:19:05 +0300284## Title Slide: QR Code and Logos
285
286Three optional yaml entries brand the title slide for external audiences:
287
288``` yaml
289title: "Habits"
Marc Kupietzb2cc5232026-08-29 16:21:52 +0300290website: "https://gitlab.ids-mannheim.de/ids/revealjs"
Marc Kupietz59e95a62026-08-29 10:19:05 +0300291partner_logo: "dnb-logo.svg"
292funder_logo: "textplus-logo.svg"
293output: revealjs.ids::revealjs_presentation
294```
295
296- `website` places a linked QR code (pointing to the URL) in the top left of the title slide. Requires the `qrcode` package.
297
298- `partner_logo`, a path or URL to a second institution's logo, shows it next to the IDS logo in the top right of *every* slide -- for presentations given by authors from two institutions.
299
300- `funder_logo`, a path or URL to a funder logo, shows it in the bottom left of the title slide, opposite the Leibniz Gemeinschaft membership logo. It is lifted above the footer band on print (pdf) pages.
301
302Local logo files (svg, png, jpg, gif, webp) are embedded in the html as data URIs, so they do not need to be shipped with the presentation; http(s) URLs are used as-is. A linked QR code at any other place on a slide can be produced with `revealjs.ids::qrlink("https://...")` in inline R code. On the title slide the navigation chrome (arrows, slide number, menu button) is hidden, for a bare first impression.
303
JJ Allaire41921d32016-01-30 19:11:43 -0500304## Slide Transitions
305
Jon Caldera35857d2017-04-11 16:38:58 +0200306You can use the `transition` and `background_transition` options to specify the global default slide transition style:
JJ Allaire41921d32016-01-30 19:11:43 -0500307
Marc Kupietze195cea2026-08-17 13:17:33 +0200308- `transition` specifies the visual effect when moving between slides. Available transitions are `r (trans <- knitr::combine_words(setdiff(revealjs.ids:::revealjs_transitions(), "default"), before = '"', and = " or "))`.
JJ Allaire41921d32016-01-30 19:11:43 -0500309
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200310- `background_transition` specifies the background transition effect when moving between full page slides. Available transitions are `r trans`
JJ Allaire41921d32016-01-30 19:11:43 -0500311
312For example:
313
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200314``` yaml
315output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200316 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200317 transition: fade
318 background_transition: slide
319```
JJ Allaire41921d32016-01-30 19:11:43 -0500320
321You can override the global transition for a specific slide by using the data-transition attribute, for example:
322
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200323``` markdown
324## Use a zoom transition {data-transition="zoom"}
325
326## Use a faster speed {data-transition-speed="fast"}
327```
328
JJ Allaire41921d32016-01-30 19:11:43 -0500329You can also use different in and out transitions for the same slide, for example:
330
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200331``` markdown
332## Fade in, Slide out {data-transition="slide-in fade-out"}
JJ Allaire41921d32016-01-30 19:11:43 -0500333
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200334## Slide in, Fade out {data-transition="fade-in slide-out"}
335```
336
337This works also for background transition
338
339``` markdown
340## Use a zoomed background transition {data-background-transition="zoom"}
341```
342
343[Revealjs documentation about transitions](https://revealjs.com/transitions/)
JJ Allaire41921d32016-01-30 19:11:43 -0500344
JJ Allaire8382c3e2016-01-30 19:04:31 -0500345## Slide Backgrounds
346
347Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a data-background attribute to your slide header element. Four different types of backgrounds are supported: color, image, video and iframe. Below are a few examples.
348
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200349``` markdown
350## CSS color background {data-background-color=#ff0000}
351
352## Full size image background {data-background-image="background.jpeg"}
353
354## Video background {data-background-video="background.mp4"}
355
356## Embed a web page as a background {data-background-iframe="https://example.com"}
357```
358
359Backgrounds transition using a fade animation by default. This can be changed to a linear sliding transition by specifying the `background-transition: slide`. Alternatively you can set `data-background-transition` on any slide with a background to override that specific transition.
360
361[Revealjs documentation about backgrounds](https://revealjs.com/backgrounds/)
JJ Allaire8382c3e2016-01-30 19:04:31 -0500362
Jon Caldera35857d2017-04-11 16:38:58 +0200363## 2-D Presentations
JJ Allairede1ed652016-01-30 19:41:18 -0500364
365You can use the `slide_level` option to specify which level of heading will be used to denote individual slides. If `slide_level` is 2 (the default), a two-dimensional layout will be produced, with level 1 headers building horizontally and level 2 headers building vertically. For example:
366
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200367``` markdown
368# Horizontal Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500369
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200370## Vertical Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500371
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200372## Vertical Slide 2
JJ Allairede1ed652016-01-30 19:41:18 -0500373
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200374# Horizontal Slide 2
375```
376
377With this layout horizontal navigation will proceed directly from "Horizontal Slide 1" to "Horizontal Slide 2", with vertical navigation to "Vertical Slide 1", etc. presented as an option on "Horizontal Slide 1". Global reveal option [`navigationMode`](https://revealjs.com/vertical-slides/#navigation-mode) can be tweaked to change this behavior.
JJ Allairede1ed652016-01-30 19:41:18 -0500378
JJ Allaire5f514242016-07-12 10:28:23 -0400379## Reveal Options
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500380
JJ Allaire064552c2017-02-10 10:28:41 -0500381Reveal.js has many additional options to configure it's behavior. You can specify any of these options using `reveal_options`, for example:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500382
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200383``` yaml
384---
385title: "Habits"
386output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200387 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200388 self_contained: false
389 reveal_options:
390 slideNumber: true
391 previewLinks: true
392---
393```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500394
Darren Tsaic2969582022-03-11 22:33:33 +0800395You can find documentation on the various available Reveal.js options here: <https://revealjs.com/config/>.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500396
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500397## Figure Options
398
399There are a number of options that affect the output of figures within reveal.js presentations:
400
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200401- `fig_width` and `fig_height` can be used to control the default figure width and height (7x5 is used by default)
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500402
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200403- `fig_retina` Specifies the scaling to perform for retina displays (defaults to 2, which currently works for all widely used retina displays). Note that this only takes effect if you are using knitr >= 1.5.21. Set to `null` to prevent retina scaling.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500404
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200405- `fig_caption` controls whether figures are rendered with captions
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500406
407For example:
408
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200409``` yaml
410---
411title: "Habits"
412output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200413 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200414 fig_width: 7
415 fig_height: 6
416 fig_caption: true
417---
418```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500419
Marc Kupietzcf6e9982026-08-15 15:37:40 +0200420## Lightbox
421
422reveal.js 5.2 added a [lightbox](https://revealjs.com/lightbox/): any element on a slide can be turned into a clickable trigger that opens an image or video full-size in a dimmed overlay, without leaving the slide. This is useful for dense figures or tables that should stay readable in the slide layout but be inspectable at full size during a presentation.
423
424Add the corresponding data attribute to an image:
425
426```markdown
427![Figure](plot.png){data-preview-image}
428```
429
430or set it on knitr-generated figures via `out.extra`:
431
432````markdown
433```{r, out.extra='data-preview-image'}
434plot(cars)
435```
436````
437
438Clicking the image on the slide opens it full-size; `Esc` or another click closes the overlay.
439
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500440## MathJax Equations
441
442By default [MathJax](http://www.mathjax.org/) scripts are included in reveal.js presentations for rendering LaTeX and MathML equations. You can use the `mathjax` option to control how MathJax is included:
443
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200444- Specify "default" to use an https URL from the official MathJax CDN.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500445
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200446- Specify "local" to use a local version of MathJax (which is copied into the output directory). Note that when using "local" you also need to set the `self_contained` option to false.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500447
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200448- Specify an alternate URL to load MathJax from another location.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500449
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200450- Specify null to exclude MathJax entirely.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500451
452For example, to use a local copy of MathJax:
453
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200454``` yaml
455---
456title: "Habits"
457output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200458 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200459 mathjax: local
460 self_contained: false
461---
462```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500463
464To use a self-hosted copy of MathJax:
465
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200466``` yaml
467---
468title: "Habits"
469output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200470 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200471 mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
472---
473```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500474
475To exclude MathJax entirely:
476
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200477``` yaml
478---
479title: "Habits"
480output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200481 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200482 mathjax: null
483---
484```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500485
486## Document Dependencies
487
Jon Caldera35857d2017-04-11 16:38:58 +0200488By default R Markdown produces standalone HTML files with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. This means you can share or publish the file just like you share Office documents or PDFs. If you'd rather keep dependencies in external files you can specify `self_contained: false`. For example:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500489
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200490``` yaml
491---
492title: "Habits"
493output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200494 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200495 self_contained: false
496---
497```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500498
499Note that even for self contained documents MathJax is still loaded externally (this is necessary because of it's size). If you want to serve MathJax locally then you should specify `mathjax: local` and `self_contained: false`.
500
501One common reason keep dependencies external is for serving R Markdown documents from a website (external dependencies can be cached separately by browsers leading to faster page load times). In the case of serving multiple R Markdown documents you may also want to consolidate dependent library files (e.g. Bootstrap, MathJax, etc.) into a single directory shared by multiple documents. You can use the `lib_dir` option to do this, for example:
502
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200503``` yaml
504---
505title: "Habits"
506output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200507 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200508 self_contained: false
509 lib_dir: libs
510---
511```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500512
JJ Allaire5f514242016-07-12 10:28:23 -0400513## Reveal Plugins
JJ Allaire82a8dee2016-07-12 10:25:36 -0400514
515You can enable various reveal.js plugins using the `reveal_plugins` option. Plugins currently supported include:
516
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200517| Plugin | Description |
518|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
519| [notes](https://revealjs.com/speaker-view/) | Present per-slide notes in a separate browser window. Open Note view pressing `S`. |
520| [zoom](http://lab.hakim.se/zoom-js/) | Zoom in and out of selected content with `Alt+Click.` |
521| [search](https://github.com/hakimel/reveal.js/blob/master/plugin/search/search.js) | Find a text string anywhere in the slides and show the next occurrence to the user. Open search box using `CTRL + SHIFT + F`. |
522| [chalkboard](https://github.com/rajgoel/reveal.js-plugins/tree/master/chalkboard) | Include handwritten notes within a presentation. Press `c` to write on slides, Press `b` to open a whiteboard or chalkboard to write. |
523| [menu](https://github.com/denehyg/reveal.js-menu) | Include a navigation menu within a presentation. Press `m` to open the menu. |
JJ Allaire82a8dee2016-07-12 10:25:36 -0400524
Marc Kupietzb9a8cba2026-08-28 06:51:28 +0300525The plugins `notes`, `search`, `menu`, and `zoom` are activated by default; only `chalkboard` is opt-in. Setting `reveal_plugins` yourself replaces the default set, so to add `chalkboard` while keeping the defaults, list them all explicitly. Set `reveal_plugins: null` to render without any plugins.
526
527Note that the use of plugins requires that the `self_contained` option be set to false. For example, this presentation uses only the "notes" and "search" plugins (dropping "menu" and "zoom" from the default set):
JJ Allaire82a8dee2016-07-12 10:25:36 -0400528
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200529``` yaml
530---
531title: "Habits"
532output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200533 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200534 self_contained: false
535 reveal_plugins: ["notes", "search"]
536---
537```
JJ Allaire82a8dee2016-07-12 10:25:36 -0400538
JJ Allaire064552c2017-02-10 10:28:41 -0500539You can specify additional options for the `chalkboard` and `menu` plugins using `reveal_options`, for example:
JJ Allaire375805c2016-11-15 08:56:43 -0500540
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200541``` yaml
542---
543title: "Habits"
544output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200545 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200546 self_contained: false
547 reveal_plugins: ["chalkboard", "menu"]
548 reveal_options:
549 chalkboard:
550 theme: whiteboard
551 toggleNotesButton: false
552 menu:
553 side: right
554---
555```
JJ Allaire375805c2016-11-15 08:56:43 -0500556
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200557No other plugins can be added in `revealjs_presentation()`. You can open feature request for new plugins or you would need to use a custom template to write your own HTML format including custom plugins.
JJ Allaire375805c2016-11-15 08:56:43 -0500558
Marc Kupietz26096d32026-08-15 15:03:33 +0200559## Bibliography and Appendix Slides
560
Marc Kupietz66dbe362026-08-31 10:58:20 +0200561When you cite with `[@key]` and set a `bibliography:` in the yaml header, the references are formatted with the bundled IDS citation style by default (based on the style developed for ICLC-10 2023 in Mannheim). To use a different style, specify it as usual with `csl:` in the yaml header. The `ids` theme auto-fits the references slide: it tries decreasing font sizes and, when the bibliography is too long even for the smallest, moves trailing entries onto automatically created "References (cont.)" slides. When printing to PDF, the on-screen scroll box is disabled so long bibliographies flow across pages instead of being clipped.
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300562
563Pandoc/citeproc generates the reference list **at the very end of the document body**. That is fine when the references are your last content:
Marc Kupietz26096d32026-08-15 15:03:33 +0200564
565```markdown
566# References
567
568## References
569```
570
571If you want slides to follow the references -- typically an appendix with spare slides -- the bibliography would otherwise end up inside your last appendix slide. Place it explicitly with a `::: {#refs}` fenced div, and the appendix forms its own chapter group after the references; navigation and slide numbering keep working:
572
573```markdown
574# References
575
576## References
577
578::: {#refs}
579:::
580
581# Appendix
582
583## Spare slide
584
585- Some backup material
586```
587
588The `{#refs}` placeholder itself does not produce a slide.
589
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500590## Advanced Customization
591
592### Includes
593
594You can do more advanced customization of output by including additional HTML content or by replacing the core pandoc template entirely. To include content in the document header or before/after the document body you use the `includes` option as follows:
595
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200596``` yaml
597---
598title: "Habits"
599output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200600 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200601 includes:
602 in_header: header.html
603 before_body: doc_prefix.html
604 after_body: doc_suffix.html
605---
606```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500607
608### Pandoc Arguments
609
Jon Caldera35857d2017-04-11 16:38:58 +0200610If there are pandoc features you want to use that lack equivalents in the YAML options described above you can still use them by passing custom `pandoc_args`. For example:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500611
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200612``` yaml
613---
614title: "Habits"
615output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200616 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200617 pandoc_args: [
618 "--title-prefix", "Foo",
619 "--id-prefix", "Bar"
620 ]
621---
622```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500623
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +0900624Documentation on all available pandoc arguments can be found in the [pandoc user guide](https://pandoc.org/MANUAL.html#options).
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500625
626## Shared Options
627
Jon Caldera35857d2017-04-11 16:38:58 +0200628If you want to specify a set of default options to be shared by multiple documents within a directory you can include a file named `_output.yaml` within the directory. Note that no YAML delimiters or enclosing output object are used in this file. For example:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500629
630**\_output.yaml**
631
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200632``` yaml
Marc Kupietze195cea2026-08-17 13:17:33 +0200633revealjs.ids::revealjs_presentation:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500634 transition: fade
635 highlight: pygments
636```
637
638All documents located in the same directory as `_output.yaml` will inherit it's options. Options defined explicitly within documents will override those specified in the shared options file.
Christophe Dervieux7f1add52021-09-15 15:42:07 +0200639
640## Code of Conduct
641
642Please note that the revealjs project is released with a [Contributor Code of Conduct](https://pkgs.rstudio.com/revealjs/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.