blob: c0a9d2c43c4d4ad1fd29ceef62d136bb8b0c2842 [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
Marc Kupietz2aa80632023-10-09 23:19:46 +020014Generated from [examples/ids.Rmd](./examples/ids.Rmd).
15
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
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +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:::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 Kupietz16a24fd2023-10-07 21:41:10 +020030devtools::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
40output: revealjs::revealjs_presentation
41---
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
112- `'m'` enable menu mode when the 'menu' plugin is activated
113
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500114Pressing `Esc` exits all of these modes.
115
116## Incremental Bullets
117
118You can render bullets incrementally by adding the `incremental` option:
119
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200120``` yaml
121---
122output:
123 revealjs::revealjs_presentation:
124 incremental: true
125---
126```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500127
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200128If you want to render bullets incrementally for some slides but not others you can use this syntax:
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500129
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200130``` markdown
131::: incremental
132
133- Eat spaghetti
134- Drink wine
135
136:::
137```
138
139or
140
141``` markdown
142::: nonincremental
143
144- Eat spaghetti
145- Drink wine
146
147:::
148```
149
150## Incremental Revealing
151
152You can also add pauses between content on a slide using `. . .`
153
154``` markdown
155# Slide header
156
157Content shown first
158
159. . .
160
161Content shown next on the same slide
162```
163
164Using Fragments explicitly is also possible
165
166``` markdown
167# Slide header
168
169Content shown first
170
171::: fragment
172Content shown next on the same slide
173:::
174```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500175
176## Appearance and Style
177
178There are several options that control the appearance of revealjs presentations:
179
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200180- `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 -0500181
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200182- `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 -0500183
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200184- `center` specifies whether you want to vertically center content on slides (this defaults to false).
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500185
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500186For example:
187
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200188``` yaml
189output:
190 revealjs::revealjs_presentation:
191 theme: sky
192 highlight: pygments
193 center: true
194```
195
196[Revealjs documentation about themes](https://revealjs.com/themes/)
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500197
JJ Allaire41921d32016-01-30 19:11:43 -0500198## Slide Transitions
199
Jon Caldera35857d2017-04-11 16:38:58 +0200200You can use the `transition` and `background_transition` options to specify the global default slide transition style:
JJ Allaire41921d32016-01-30 19:11:43 -0500201
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200202- `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 -0500203
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200204- `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 -0500205
206For example:
207
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200208``` yaml
209output:
210 revealjs::revealjs_presentation:
211 transition: fade
212 background_transition: slide
213```
JJ Allaire41921d32016-01-30 19:11:43 -0500214
215You can override the global transition for a specific slide by using the data-transition attribute, for example:
216
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200217``` markdown
218## Use a zoom transition {data-transition="zoom"}
219
220## Use a faster speed {data-transition-speed="fast"}
221```
222
JJ Allaire41921d32016-01-30 19:11:43 -0500223You can also use different in and out transitions for the same slide, for example:
224
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200225``` markdown
226## Fade in, Slide out {data-transition="slide-in fade-out"}
JJ Allaire41921d32016-01-30 19:11:43 -0500227
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200228## Slide in, Fade out {data-transition="fade-in slide-out"}
229```
230
231This works also for background transition
232
233``` markdown
234## Use a zoomed background transition {data-background-transition="zoom"}
235```
236
237[Revealjs documentation about transitions](https://revealjs.com/transitions/)
JJ Allaire41921d32016-01-30 19:11:43 -0500238
JJ Allaire8382c3e2016-01-30 19:04:31 -0500239## Slide Backgrounds
240
241Slides 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.
242
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200243``` markdown
244## CSS color background {data-background-color=#ff0000}
245
246## Full size image background {data-background-image="background.jpeg"}
247
248## Video background {data-background-video="background.mp4"}
249
250## Embed a web page as a background {data-background-iframe="https://example.com"}
251```
252
253Backgrounds 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.
254
255[Revealjs documentation about backgrounds](https://revealjs.com/backgrounds/)
JJ Allaire8382c3e2016-01-30 19:04:31 -0500256
Jon Caldera35857d2017-04-11 16:38:58 +0200257## 2-D Presentations
JJ Allairede1ed652016-01-30 19:41:18 -0500258
259You 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:
260
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200261``` markdown
262# Horizontal Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500263
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200264## Vertical Slide 1
JJ Allairede1ed652016-01-30 19:41:18 -0500265
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200266## Vertical Slide 2
JJ Allairede1ed652016-01-30 19:41:18 -0500267
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200268# Horizontal Slide 2
269```
270
271With 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 -0500272
JJ Allaire5f514242016-07-12 10:28:23 -0400273## Reveal Options
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500274
JJ Allaire064552c2017-02-10 10:28:41 -0500275Reveal.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 -0500276
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200277``` yaml
278---
279title: "Habits"
280output:
281 revealjs::revealjs_presentation:
282 self_contained: false
283 reveal_options:
284 slideNumber: true
285 previewLinks: true
286---
287```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500288
Darren Tsaic2969582022-03-11 22:33:33 +0800289You can find documentation on the various available Reveal.js options here: <https://revealjs.com/config/>.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500290
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500291## Figure Options
292
293There are a number of options that affect the output of figures within reveal.js presentations:
294
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200295- `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 -0500296
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200297- `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 -0500298
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200299- `fig_caption` controls whether figures are rendered with captions
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500300
301For example:
302
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200303``` yaml
304---
305title: "Habits"
306output:
307 revealjs::revealjs_presentation:
308 fig_width: 7
309 fig_height: 6
310 fig_caption: true
311---
312```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500313
314## MathJax Equations
315
316By 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:
317
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200318- Specify "default" to use an https URL from the official MathJax CDN.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500319
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200320- 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 -0500321
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200322- Specify an alternate URL to load MathJax from another location.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500323
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200324- Specify null to exclude MathJax entirely.
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500325
326For example, to use a local copy of MathJax:
327
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200328``` yaml
329---
330title: "Habits"
331output:
332 revealjs::revealjs_presentation:
333 mathjax: local
334 self_contained: false
335---
336```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500337
338To use a self-hosted copy of MathJax:
339
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200340``` yaml
341---
342title: "Habits"
343output:
344 revealjs::revealjs_presentation:
345 mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
346---
347```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500348
349To exclude MathJax entirely:
350
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200351``` yaml
352---
353title: "Habits"
354output:
355 revealjs::revealjs_presentation:
356 mathjax: null
357---
358```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500359
360## Document Dependencies
361
Jon Caldera35857d2017-04-11 16:38:58 +0200362By 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 -0500363
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200364``` yaml
365---
366title: "Habits"
367output:
368 revealjs::revealjs_presentation:
369 self_contained: false
370---
371```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500372
373Note 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`.
374
375One 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:
376
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200377``` yaml
378---
379title: "Habits"
380output:
381 revealjs::revealjs_presentation:
382 self_contained: false
383 lib_dir: libs
384---
385```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500386
JJ Allaire5f514242016-07-12 10:28:23 -0400387## Reveal Plugins
JJ Allaire82a8dee2016-07-12 10:25:36 -0400388
389You can enable various reveal.js plugins using the `reveal_plugins` option. Plugins currently supported include:
390
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200391| Plugin | Description |
392|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
393| [notes](https://revealjs.com/speaker-view/) | Present per-slide notes in a separate browser window. Open Note view pressing `S`. |
394| [zoom](http://lab.hakim.se/zoom-js/) | Zoom in and out of selected content with `Alt+Click.` |
395| [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`. |
396| [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. |
397| [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 -0400398
399Note 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:
400
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200401``` yaml
402---
403title: "Habits"
404output:
405 revealjs::revealjs_presentation:
406 self_contained: false
407 reveal_plugins: ["notes", "search"]
408---
409```
JJ Allaire82a8dee2016-07-12 10:25:36 -0400410
JJ Allaire064552c2017-02-10 10:28:41 -0500411You can specify additional options for the `chalkboard` and `menu` plugins using `reveal_options`, for example:
JJ Allaire375805c2016-11-15 08:56:43 -0500412
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200413``` yaml
414---
415title: "Habits"
416output:
417 revealjs::revealjs_presentation:
418 self_contained: false
419 reveal_plugins: ["chalkboard", "menu"]
420 reveal_options:
421 chalkboard:
422 theme: whiteboard
423 toggleNotesButton: false
424 menu:
425 side: right
426---
427```
JJ Allaire375805c2016-11-15 08:56:43 -0500428
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200429No 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 -0500430
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500431## Advanced Customization
432
433### Includes
434
435You 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:
436
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200437``` yaml
438---
439title: "Habits"
440output:
441 revealjs::revealjs_presentation:
442 includes:
443 in_header: header.html
444 before_body: doc_prefix.html
445 after_body: doc_suffix.html
446---
447```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500448
449### Pandoc Arguments
450
Jon Caldera35857d2017-04-11 16:38:58 +0200451If 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 -0500452
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200453``` yaml
454---
455title: "Habits"
456output:
457 revealjs::revealjs_presentation:
458 pandoc_args: [
459 "--title-prefix", "Foo",
460 "--id-prefix", "Bar"
461 ]
462---
463```
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500464
Atsushi Yasumotoe734cd82020-08-10 21:48:18 +0900465Documentation 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 -0500466
467## Shared Options
468
Jon Caldera35857d2017-04-11 16:38:58 +0200469If 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 -0500470
471**\_output.yaml**
472
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +0200473``` yaml
JJ Allaire5dc9fe02016-01-30 18:44:51 -0500474revealjs::revealjs_presentation:
475 theme: sky
476 transition: fade
477 highlight: pygments
478```
479
480All 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 +0200481
482## Code of Conduct
483
484Please 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.