blob: 2ee137593eb40c02ab14d51ee4c35bc6d482e898 [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 Kupietz24a129b2023-10-10 14:04:32 +020014Generated from [examples/ids.Rmd](./examples/ids.Rmd), see live demo [here](http://10.0.1.45/slides/2023-10-08-Revealjs-demo/ids.html).
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)
19![lvc](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/lvc.png?job=build-job)
20
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
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +090033To 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 -050034
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020035``` markdown
36---
37title: "Habits"
38author: John Doe
39date: March 22, 2005
Marc Kupietze195cea2026-08-17 13:17:33 +020040output: revealjs.ids::revealjs_presentation
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020041---
JJ Allaire5dc9fe02016-01-30 18:44:51 -050042
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020043# In the morning
JJ Allaire5dc9fe02016-01-30 18:44:51 -050044
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020045## Getting up
JJ Allaire5dc9fe02016-01-30 18:44:51 -050046
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020047- Turn off alarm
48- Get out of bed
JJ Allaire5dc9fe02016-01-30 18:44:51 -050049
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020050## Breakfast
JJ Allaire5dc9fe02016-01-30 18:44:51 -050051
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020052- Eat eggs
53- Drink coffee
JJ Allaire5dc9fe02016-01-30 18:44:51 -050054
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020055# In the evening
JJ Allaire5dc9fe02016-01-30 18:44:51 -050056
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020057## Dinner
JJ Allaire5dc9fe02016-01-30 18:44:51 -050058
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020059- Eat spaghetti
60- Drink wine
JJ Allaire5dc9fe02016-01-30 18:44:51 -050061
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020062## Going to sleep
JJ Allaire5dc9fe02016-01-30 18:44:51 -050063
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020064- Get in bed
65- Count sheep
66```
JJ Allaire5dc9fe02016-01-30 18:44:51 -050067
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020068## Rendering
Daniel Chen46087c32016-03-21 17:58:14 -040069
Daniel Chen81a14342016-03-21 18:00:56 -040070Depending on your use case, there are 3 ways you can render the presentation.
Daniel Chen46087c32016-03-21 17:58:14 -040071
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200721. RStudio
732. R console
743. Terminal (e.g., bash)
Daniel Chen46087c32016-03-21 17:58:14 -040075
76### RStudio
77
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020078When 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 -040079
80### R Console
81
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020082The `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 -040083
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020084``` r
Daniel Chen46087c32016-03-21 17:58:14 -040085rmarkdown::render('my_reveal_presentation.Rmd')
86```
87
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020088There 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 -040089
90### Command Line
91
92When you need the presentation to be rendered from the command line:
93
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020094``` bash
Daniel Chen46087c32016-03-21 17:58:14 -040095Rscript -e "rmarkdown::render('my_reveal_presentation.Rmd')"
96```
97
JJ Allaire5dc9fe02016-01-30 18:44:51 -050098## Display Modes
99
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200100The following single character keyboard shortcuts enable alternate display modes:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500101
102- `'f'` enable fullscreen mode
103
104- `'o'` enable overview mode
105
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200106- `'b'` enable pause mode with a black screen hiding slide content
107
108- `'?'` enable help mode to show keyboard shortcut cheatsheet
109
110- `'s'` enable presentation mode with speaker notes when the Notes plugin is activated
111
Marc Kupietz88799182026-08-24 09:22:33 +0300112On 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.
113
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200114- `'m'` enable menu mode when the 'menu' plugin is activated
115
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500116Pressing `Esc` exits all of these modes.
117
Marc Kupietzb066e742026-08-23 09:57:06 +0300118## Slide Timing
119
120You 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:
121
122``` markdown
123## My slide title
124
125Some content
126
127<!-- JD 00:30 -->
128```
129
Marc Kupietz6b65c032026-08-25 09:43:28 +0300130This 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 +0300131
132``` markdown
133## My slide title
134
135Some content
136
137<!-- 00:30 -->
138```
139
140Typically 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):
141
142``` yaml
143output:
144 revealjs.ids::revealjs_presentation:
145 reveal_options:
146 totalTime: 3600 # one hour
147```
148
149When 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:
150
151```
152Slide timing -- JD: 0:30, AB: 1:00 -- total 1:30
153```
154
155To compute the time budget without rendering the presentation, you can call `slide_timing()` directly on the `.Rmd` source file.
156
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300157## Overview Slides
158
Marc Kupietz24057e52026-08-25 10:51:06 +0300159Like 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 a list of all `#` chapter headings, and each entry links to the corresponding slide.
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300160
161``` markdown
162## Overview
163
164(any placeholder content -- replaced automatically)
165```
166
Marc Kupietz24057e52026-08-25 10:51:06 +0300167To 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:
168
169``` markdown
170## Overview {data-overview-subheadings=true}
171```
172
Marc Kupietz4fc867c2026-08-25 10:30:18 +0300173The 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.
174
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500175## Incremental Bullets
176
177You can render bullets incrementally by adding the `incremental` option:
178
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200179``` yaml
180---
181output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200182 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200183 incremental: true
184---
185```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500186
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200187If you want to render bullets incrementally for some slides but not others you can use this syntax:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500188
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200189``` markdown
190::: incremental
191
192- Eat spaghetti
193- Drink wine
194
195:::
196```
197
198or
199
200``` markdown
201::: nonincremental
202
203- Eat spaghetti
204- Drink wine
205
206:::
207```
208
209## Incremental Revealing
210
211You can also add pauses between content on a slide using `. . .`
212
213``` markdown
214# Slide header
215
216Content shown first
217
218. . .
219
220Content shown next on the same slide
221```
222
223Using Fragments explicitly is also possible
224
225``` markdown
226# Slide header
227
228Content shown first
229
230::: fragment
231Content shown next on the same slide
232:::
233```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500234
235## Appearance and Style
236
237There are several options that control the appearance of revealjs presentations:
238
Marc Kupietze195cea2026-08-17 13:17:33 +0200239- `theme` specifies the theme to use for the presentation (available themes are `r knitr::combine_words(setdiff(revealjs.ids:::revealjs_themes(), "default"), before = '"', and = " or ")`
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500240
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200241- `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 -0500242
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200243- `center` specifies whether you want to vertically center content on slides (this defaults to false).
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500244
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500245For example:
246
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200247``` yaml
248output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200249 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200250 theme: sky
251 highlight: pygments
252 center: true
253```
254
255[Revealjs documentation about themes](https://revealjs.com/themes/)
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500256
JJ Allaire41921d32016-01-30 19:11:43 -0500257## Slide Transitions
258
Jon Caldera35857d2017-04-11 16:38:58 +0200259You can use the `transition` and `background_transition` options to specify the global default slide transition style:
JJ Allaire41921d32016-01-30 19:11:43 -0500260
Marc Kupietze195cea2026-08-17 13:17:33 +0200261- `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 -0500262
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200263- `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 -0500264
265For example:
266
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200267``` yaml
268output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200269 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200270 transition: fade
271 background_transition: slide
272```
JJ Allaire41921d32016-01-30 19:11:43 -0500273
274You can override the global transition for a specific slide by using the data-transition attribute, for example:
275
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200276``` markdown
277## Use a zoom transition {data-transition="zoom"}
278
279## Use a faster speed {data-transition-speed="fast"}
280```
281
JJ Allaire41921d32016-01-30 19:11:43 -0500282You can also use different in and out transitions for the same slide, for example:
283
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200284``` markdown
285## Fade in, Slide out {data-transition="slide-in fade-out"}
JJ Allaire41921d32016-01-30 19:11:43 -0500286
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200287## Slide in, Fade out {data-transition="fade-in slide-out"}
288```
289
290This works also for background transition
291
292``` markdown
293## Use a zoomed background transition {data-background-transition="zoom"}
294```
295
296[Revealjs documentation about transitions](https://revealjs.com/transitions/)
JJ Allaire41921d32016-01-30 19:11:43 -0500297
JJ Allaire8382c3e2016-01-30 19:04:31 -0500298## Slide Backgrounds
299
300Slides 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.
301
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200302``` markdown
303## CSS color background {data-background-color=#ff0000}
304
305## Full size image background {data-background-image="background.jpeg"}
306
307## Video background {data-background-video="background.mp4"}
308
309## Embed a web page as a background {data-background-iframe="https://example.com"}
310```
311
312Backgrounds 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.
313
314[Revealjs documentation about backgrounds](https://revealjs.com/backgrounds/)
JJ Allaire8382c3e2016-01-30 19:04:31 -0500315
Jon Caldera35857d2017-04-11 16:38:58 +0200316## 2-D Presentations
JJ Allairede1ed652016-01-30 19:41:18 -0500317
318You 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:
319
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200320``` markdown
321# Horizontal Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500322
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200323## Vertical Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500324
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200325## Vertical Slide 2
JJ Allairede1ed652016-01-30 19:41:18 -0500326
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200327# Horizontal Slide 2
328```
329
330With 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 -0500331
JJ Allaire5f514242016-07-12 10:28:23 -0400332## Reveal Options
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500333
JJ Allaire064552c2017-02-10 10:28:41 -0500334Reveal.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 -0500335
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200336``` yaml
337---
338title: "Habits"
339output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200340 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200341 self_contained: false
342 reveal_options:
343 slideNumber: true
344 previewLinks: true
345---
346```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500347
Darren Tsaic2969582022-03-11 22:33:33 +0800348You can find documentation on the various available Reveal.js options here: <https://revealjs.com/config/>.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500349
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500350## Figure Options
351
352There are a number of options that affect the output of figures within reveal.js presentations:
353
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200354- `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 -0500355
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200356- `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 -0500357
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200358- `fig_caption` controls whether figures are rendered with captions
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500359
360For example:
361
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200362``` yaml
363---
364title: "Habits"
365output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200366 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200367 fig_width: 7
368 fig_height: 6
369 fig_caption: true
370---
371```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500372
Marc Kupietzcf6e9982026-08-15 15:37:40 +0200373## Lightbox
374
375reveal.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.
376
377Add the corresponding data attribute to an image:
378
379```markdown
380![Figure](plot.png){data-preview-image}
381```
382
383or set it on knitr-generated figures via `out.extra`:
384
385````markdown
386```{r, out.extra='data-preview-image'}
387plot(cars)
388```
389````
390
391Clicking the image on the slide opens it full-size; `Esc` or another click closes the overlay.
392
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500393## MathJax Equations
394
395By 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:
396
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200397- Specify "default" to use an https URL from the official MathJax CDN.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500398
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200399- 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 -0500400
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200401- Specify an alternate URL to load MathJax from another location.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500402
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200403- Specify null to exclude MathJax entirely.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500404
405For example, to use a local copy of MathJax:
406
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200407``` yaml
408---
409title: "Habits"
410output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200411 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200412 mathjax: local
413 self_contained: false
414---
415```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500416
417To use a self-hosted copy of MathJax:
418
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200419``` yaml
420---
421title: "Habits"
422output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200423 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200424 mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
425---
426```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500427
428To exclude MathJax entirely:
429
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200430``` yaml
431---
432title: "Habits"
433output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200434 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200435 mathjax: null
436---
437```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500438
439## Document Dependencies
440
Jon Caldera35857d2017-04-11 16:38:58 +0200441By 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 -0500442
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200443``` yaml
444---
445title: "Habits"
446output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200447 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200448 self_contained: false
449---
450```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500451
452Note 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`.
453
454One 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:
455
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200456``` yaml
457---
458title: "Habits"
459output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200460 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200461 self_contained: false
462 lib_dir: libs
463---
464```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500465
JJ Allaire5f514242016-07-12 10:28:23 -0400466## Reveal Plugins
JJ Allaire82a8dee2016-07-12 10:25:36 -0400467
468You can enable various reveal.js plugins using the `reveal_plugins` option. Plugins currently supported include:
469
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200470| Plugin | Description |
471|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
472| [notes](https://revealjs.com/speaker-view/) | Present per-slide notes in a separate browser window. Open Note view pressing `S`. |
473| [zoom](http://lab.hakim.se/zoom-js/) | Zoom in and out of selected content with `Alt+Click.` |
474| [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`. |
475| [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. |
476| [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 -0400477
478Note that the use of plugins requires that the `self_contained` option be set to false. For example, this presentation includes both the "notes" and "search" plugins:
479
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200480``` yaml
481---
482title: "Habits"
483output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200484 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200485 self_contained: false
486 reveal_plugins: ["notes", "search"]
487---
488```
JJ Allaire82a8dee2016-07-12 10:25:36 -0400489
JJ Allaire064552c2017-02-10 10:28:41 -0500490You can specify additional options for the `chalkboard` and `menu` plugins using `reveal_options`, for example:
JJ Allaire375805c2016-11-15 08:56:43 -0500491
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200492``` yaml
493---
494title: "Habits"
495output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200496 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200497 self_contained: false
498 reveal_plugins: ["chalkboard", "menu"]
499 reveal_options:
500 chalkboard:
501 theme: whiteboard
502 toggleNotesButton: false
503 menu:
504 side: right
505---
506```
JJ Allaire375805c2016-11-15 08:56:43 -0500507
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200508No 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 -0500509
Marc Kupietz26096d32026-08-15 15:03:33 +0200510## Bibliography and Appendix Slides
511
Marc Kupietzad0f24b2026-08-23 10:09:05 +0300512When 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.
513
514Pandoc/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 +0200515
516```markdown
517# References
518
519## References
520```
521
522If 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:
523
524```markdown
525# References
526
527## References
528
529::: {#refs}
530:::
531
532# Appendix
533
534## Spare slide
535
536- Some backup material
537```
538
539The `{#refs}` placeholder itself does not produce a slide.
540
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500541## Advanced Customization
542
543### Includes
544
545You 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:
546
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200547``` yaml
548---
549title: "Habits"
550output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200551 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200552 includes:
553 in_header: header.html
554 before_body: doc_prefix.html
555 after_body: doc_suffix.html
556---
557```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500558
559### Pandoc Arguments
560
Jon Caldera35857d2017-04-11 16:38:58 +0200561If 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 -0500562
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200563``` yaml
564---
565title: "Habits"
566output:
Marc Kupietze195cea2026-08-17 13:17:33 +0200567 revealjs.ids::revealjs_presentation:
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200568 pandoc_args: [
569 "--title-prefix", "Foo",
570 "--id-prefix", "Bar"
571 ]
572---
573```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500574
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +0900575Documentation 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 -0500576
577## Shared Options
578
Jon Caldera35857d2017-04-11 16:38:58 +0200579If 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 -0500580
581**\_output.yaml**
582
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200583``` yaml
Marc Kupietze195cea2026-08-17 13:17:33 +0200584revealjs.ids::revealjs_presentation:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500585 theme: sky
586 transition: fade
587 highlight: pygments
588```
589
590All 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 +0200591
592## Code of Conduct
593
594Please 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.