blob: fa3ef8d79646c8ac8da3530be8584634ec187356 [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)
Christophe Dervieux8043a482021-10-28 11:51:47 +02009[![reveal.js](https://img.shields.io/badge/reveal.js-`r revealjs:::revealjs_version()`-yellow)](https://github.com/rstudio/revealjs/tree/main/inst/reveal.js-`r revealjs:::revealjs_version()`)
christophe dervieux42886a12021-09-16 11:36:01 +020010<!-- badges: end -->
11
Marc Kupietzfbf254d2023-10-09 15:10:42 +020012## Screenshots
13
14![title](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/title.png?job=build-job)
15
16![users](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/users.png?job=build-job)
17![lvc](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/lvc.png?job=build-job)
18
19![references](https://gitlab.ids-mannheim.de/ids/revealjs/-/jobs/artifacts/main/raw/target/references.png?job=build-job)
20
JJ Allaire5dc9fe02016-01-30 18:44:51 -050021## Overview
22
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020023This 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:::revealjs_version()`
JJ Allaire5dc9fe02016-01-30 18:44:51 -050024
25You can use this format in R Markdown documents by installing this package as follows:
26
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020027``` r
Marc Kupietz16a24fd2023-10-07 21:41:10 +020028devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/revealjs")
JJ Allaire5dc9fe02016-01-30 18:44:51 -050029```
30
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +090031To 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 -050032
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020033``` markdown
34---
35title: "Habits"
36author: John Doe
37date: March 22, 2005
38output: revealjs::revealjs_presentation
39---
JJ Allaire5dc9fe02016-01-30 18:44:51 -050040
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020041# In the morning
JJ Allaire5dc9fe02016-01-30 18:44:51 -050042
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020043## Getting up
JJ Allaire5dc9fe02016-01-30 18:44:51 -050044
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020045- Turn off alarm
46- Get out of bed
JJ Allaire5dc9fe02016-01-30 18:44:51 -050047
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020048## Breakfast
JJ Allaire5dc9fe02016-01-30 18:44:51 -050049
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020050- Eat eggs
51- Drink coffee
JJ Allaire5dc9fe02016-01-30 18:44:51 -050052
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020053# In the evening
JJ Allaire5dc9fe02016-01-30 18:44:51 -050054
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020055## Dinner
JJ Allaire5dc9fe02016-01-30 18:44:51 -050056
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020057- Eat spaghetti
58- Drink wine
JJ Allaire5dc9fe02016-01-30 18:44:51 -050059
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020060## Going to sleep
JJ Allaire5dc9fe02016-01-30 18:44:51 -050061
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020062- Get in bed
63- Count sheep
64```
JJ Allaire5dc9fe02016-01-30 18:44:51 -050065
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020066## Rendering
Daniel Chen46087c32016-03-21 17:58:14 -040067
Daniel Chen81a14342016-03-21 18:00:56 -040068Depending on your use case, there are 3 ways you can render the presentation.
Daniel Chen46087c32016-03-21 17:58:14 -040069
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200701. RStudio
712. R console
723. Terminal (e.g., bash)
Daniel Chen46087c32016-03-21 17:58:14 -040073
74### RStudio
75
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020076When 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 -040077
78### R Console
79
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020080The `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 -040081
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020082``` r
Daniel Chen46087c32016-03-21 17:58:14 -040083rmarkdown::render('my_reveal_presentation.Rmd')
84```
85
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020086There 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 -040087
88### Command Line
89
90When you need the presentation to be rendered from the command line:
91
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020092``` bash
Daniel Chen46087c32016-03-21 17:58:14 -040093Rscript -e "rmarkdown::render('my_reveal_presentation.Rmd')"
94```
95
JJ Allaire5dc9fe02016-01-30 18:44:51 -050096## Display Modes
97
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020098The following single character keyboard shortcuts enable alternate display modes:
JJ Allaire5dc9fe02016-01-30 18:44:51 -050099
100- `'f'` enable fullscreen mode
101
102- `'o'` enable overview mode
103
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200104- `'b'` enable pause mode with a black screen hiding slide content
105
106- `'?'` enable help mode to show keyboard shortcut cheatsheet
107
108- `'s'` enable presentation mode with speaker notes when the Notes plugin is activated
109
110- `'m'` enable menu mode when the 'menu' plugin is activated
111
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500112Pressing `Esc` exits all of these modes.
113
114## Incremental Bullets
115
116You can render bullets incrementally by adding the `incremental` option:
117
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200118``` yaml
119---
120output:
121 revealjs::revealjs_presentation:
122 incremental: true
123---
124```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500125
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200126If you want to render bullets incrementally for some slides but not others you can use this syntax:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500127
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200128``` markdown
129::: incremental
130
131- Eat spaghetti
132- Drink wine
133
134:::
135```
136
137or
138
139``` markdown
140::: nonincremental
141
142- Eat spaghetti
143- Drink wine
144
145:::
146```
147
148## Incremental Revealing
149
150You can also add pauses between content on a slide using `. . .`
151
152``` markdown
153# Slide header
154
155Content shown first
156
157. . .
158
159Content shown next on the same slide
160```
161
162Using Fragments explicitly is also possible
163
164``` markdown
165# Slide header
166
167Content shown first
168
169::: fragment
170Content shown next on the same slide
171:::
172```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500173
174## Appearance and Style
175
176There are several options that control the appearance of revealjs presentations:
177
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200178- `theme` specifies the theme to use for the presentation (available themes are `r knitr::combine_words(setdiff(revealjs:::revealjs_themes(), "default"), before = '"', and = " or ")`
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500179
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200180- `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 -0500181
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200182- `center` specifies whether you want to vertically center content on slides (this defaults to false).
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500183
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500184For example:
185
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200186``` yaml
187output:
188 revealjs::revealjs_presentation:
189 theme: sky
190 highlight: pygments
191 center: true
192```
193
194[Revealjs documentation about themes](https://revealjs.com/themes/)
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500195
JJ Allaire41921d32016-01-30 19:11:43 -0500196## Slide Transitions
197
Jon Caldera35857d2017-04-11 16:38:58 +0200198You can use the `transition` and `background_transition` options to specify the global default slide transition style:
JJ Allaire41921d32016-01-30 19:11:43 -0500199
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200200- `transition` specifies the visual effect when moving between slides. Available transitions are `r (trans <- knitr::combine_words(setdiff(revealjs:::revealjs_transitions(), "default"), before = '"', and = " or "))`.
JJ Allaire41921d32016-01-30 19:11:43 -0500201
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200202- `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 -0500203
204For example:
205
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200206``` yaml
207output:
208 revealjs::revealjs_presentation:
209 transition: fade
210 background_transition: slide
211```
JJ Allaire41921d32016-01-30 19:11:43 -0500212
213You can override the global transition for a specific slide by using the data-transition attribute, for example:
214
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200215``` markdown
216## Use a zoom transition {data-transition="zoom"}
217
218## Use a faster speed {data-transition-speed="fast"}
219```
220
JJ Allaire41921d32016-01-30 19:11:43 -0500221You can also use different in and out transitions for the same slide, for example:
222
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200223``` markdown
224## Fade in, Slide out {data-transition="slide-in fade-out"}
JJ Allaire41921d32016-01-30 19:11:43 -0500225
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200226## Slide in, Fade out {data-transition="fade-in slide-out"}
227```
228
229This works also for background transition
230
231``` markdown
232## Use a zoomed background transition {data-background-transition="zoom"}
233```
234
235[Revealjs documentation about transitions](https://revealjs.com/transitions/)
JJ Allaire41921d32016-01-30 19:11:43 -0500236
JJ Allaire8382c3e2016-01-30 19:04:31 -0500237## Slide Backgrounds
238
239Slides 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.
240
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200241``` markdown
242## CSS color background {data-background-color=#ff0000}
243
244## Full size image background {data-background-image="background.jpeg"}
245
246## Video background {data-background-video="background.mp4"}
247
248## Embed a web page as a background {data-background-iframe="https://example.com"}
249```
250
251Backgrounds 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.
252
253[Revealjs documentation about backgrounds](https://revealjs.com/backgrounds/)
JJ Allaire8382c3e2016-01-30 19:04:31 -0500254
Jon Caldera35857d2017-04-11 16:38:58 +0200255## 2-D Presentations
JJ Allairede1ed652016-01-30 19:41:18 -0500256
257You 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:
258
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200259``` markdown
260# Horizontal Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500261
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200262## Vertical Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500263
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200264## Vertical Slide 2
JJ Allairede1ed652016-01-30 19:41:18 -0500265
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200266# Horizontal Slide 2
267```
268
269With 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 -0500270
JJ Allaire5f514242016-07-12 10:28:23 -0400271## Reveal Options
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500272
JJ Allaire064552c2017-02-10 10:28:41 -0500273Reveal.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 -0500274
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200275``` yaml
276---
277title: "Habits"
278output:
279 revealjs::revealjs_presentation:
280 self_contained: false
281 reveal_options:
282 slideNumber: true
283 previewLinks: true
284---
285```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500286
Darren Tsaic2969582022-03-11 22:33:33 +0800287You can find documentation on the various available Reveal.js options here: <https://revealjs.com/config/>.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500288
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500289## Figure Options
290
291There are a number of options that affect the output of figures within reveal.js presentations:
292
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200293- `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 -0500294
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200295- `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 -0500296
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200297- `fig_caption` controls whether figures are rendered with captions
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500298
299For example:
300
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200301``` yaml
302---
303title: "Habits"
304output:
305 revealjs::revealjs_presentation:
306 fig_width: 7
307 fig_height: 6
308 fig_caption: true
309---
310```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500311
312## MathJax Equations
313
314By 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:
315
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200316- Specify "default" to use an https URL from the official MathJax CDN.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500317
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200318- 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 -0500319
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200320- Specify an alternate URL to load MathJax from another location.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500321
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200322- Specify null to exclude MathJax entirely.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500323
324For example, to use a local copy of MathJax:
325
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200326``` yaml
327---
328title: "Habits"
329output:
330 revealjs::revealjs_presentation:
331 mathjax: local
332 self_contained: false
333---
334```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500335
336To use a self-hosted copy of MathJax:
337
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200338``` yaml
339---
340title: "Habits"
341output:
342 revealjs::revealjs_presentation:
343 mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
344---
345```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500346
347To exclude MathJax entirely:
348
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200349``` yaml
350---
351title: "Habits"
352output:
353 revealjs::revealjs_presentation:
354 mathjax: null
355---
356```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500357
358## Document Dependencies
359
Jon Caldera35857d2017-04-11 16:38:58 +0200360By 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 -0500361
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200362``` yaml
363---
364title: "Habits"
365output:
366 revealjs::revealjs_presentation:
367 self_contained: false
368---
369```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500370
371Note 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`.
372
373One 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:
374
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200375``` yaml
376---
377title: "Habits"
378output:
379 revealjs::revealjs_presentation:
380 self_contained: false
381 lib_dir: libs
382---
383```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500384
JJ Allaire5f514242016-07-12 10:28:23 -0400385## Reveal Plugins
JJ Allaire82a8dee2016-07-12 10:25:36 -0400386
387You can enable various reveal.js plugins using the `reveal_plugins` option. Plugins currently supported include:
388
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200389| Plugin | Description |
390|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
391| [notes](https://revealjs.com/speaker-view/) | Present per-slide notes in a separate browser window. Open Note view pressing `S`. |
392| [zoom](http://lab.hakim.se/zoom-js/) | Zoom in and out of selected content with `Alt+Click.` |
393| [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`. |
394| [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. |
395| [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 -0400396
397Note 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:
398
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200399``` yaml
400---
401title: "Habits"
402output:
403 revealjs::revealjs_presentation:
404 self_contained: false
405 reveal_plugins: ["notes", "search"]
406---
407```
JJ Allaire82a8dee2016-07-12 10:25:36 -0400408
JJ Allaire064552c2017-02-10 10:28:41 -0500409You can specify additional options for the `chalkboard` and `menu` plugins using `reveal_options`, for example:
JJ Allaire375805c2016-11-15 08:56:43 -0500410
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200411``` yaml
412---
413title: "Habits"
414output:
415 revealjs::revealjs_presentation:
416 self_contained: false
417 reveal_plugins: ["chalkboard", "menu"]
418 reveal_options:
419 chalkboard:
420 theme: whiteboard
421 toggleNotesButton: false
422 menu:
423 side: right
424---
425```
JJ Allaire375805c2016-11-15 08:56:43 -0500426
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200427No 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 -0500428
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500429## Advanced Customization
430
431### Includes
432
433You 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:
434
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200435``` yaml
436---
437title: "Habits"
438output:
439 revealjs::revealjs_presentation:
440 includes:
441 in_header: header.html
442 before_body: doc_prefix.html
443 after_body: doc_suffix.html
444---
445```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500446
447### Pandoc Arguments
448
Jon Caldera35857d2017-04-11 16:38:58 +0200449If 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 -0500450
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200451``` yaml
452---
453title: "Habits"
454output:
455 revealjs::revealjs_presentation:
456 pandoc_args: [
457 "--title-prefix", "Foo",
458 "--id-prefix", "Bar"
459 ]
460---
461```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500462
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +0900463Documentation 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 -0500464
465## Shared Options
466
Jon Caldera35857d2017-04-11 16:38:58 +0200467If 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 -0500468
469**\_output.yaml**
470
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200471``` yaml
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500472revealjs::revealjs_presentation:
473 theme: sky
474 transition: fade
475 highlight: pygments
476```
477
478All 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 +0200479
480## Code of Conduct
481
482Please 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.