| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 1 | #' Convert to a reveal.js presentation |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 2 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 3 | #' Format for converting from R Markdown to a reveal.js presentation. |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 4 | #' |
| 5 | #' In reveal.js presentations you can use level 1 or level 2 headers for slides. |
| 6 | #' If you use a mix of level 1 and level 2 headers then a two-dimensional layout |
| 7 | #' will be produced, with level 1 headers building horizontally and level 2 |
| 8 | #' headers building vertically. |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 9 | #' |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 10 | #' For additional documentation on using revealjs presentations see |
| 11 | #' <https://github.com/rstudio/revealjs> |
| 12 | #' |
| 13 | #' # About plugins |
| Marc Kupietz | b9a8cba | 2026-08-28 06:51:28 +0300 | [diff] [blame] | 14 | #' |
| 15 | #' The plugins `notes`, `search`, `menu` and `zoom` are activated by default; |
| 16 | #' only `chalkboard` is opt-in. Setting `reveal_plugins` replaces the default |
| 17 | #' set -- pass `NULL` to render without any plugins. |
| 18 | #' |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 19 | #' ## Built-in plugins with reveal.js |
| Marc Kupietz | b9a8cba | 2026-08-28 06:51:28 +0300 | [diff] [blame] | 20 | #' |
| 21 | #' ### Zoom |
| 22 | #' |
| 23 | #' Activated by default: ALT + Click can be used to zoom on a slide. |
| 24 | #' |
| 25 | #' ### Notes |
| 26 | #' |
| 27 | #' Activated by default: shows a [speaker view](https://revealjs.com/speaker-view/) in a separated |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 28 | #' window. This speaker view contains a timer, current slide, next slide, and |
| 29 | #' speaker notes. It also duplicate the window to have presentation mode |
| 30 | #' synchronized with main presentation. |
| 31 | #' |
| 32 | #' Use |
| 33 | #' ```markdown |
| 34 | #' ::: notes |
| 35 | #' Content of speaker notes |
| 36 | #' ::: |
| 37 | #' ``` |
| Marc Kupietz | 6b65c03 | 2026-08-25 09:43:28 +0300 | [diff] [blame] | 38 | #' to create notes only viewable in presentation mode. Notes placed before |
| 39 | #' the first heading are attached to the title slide. |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 40 | #' |
| Marc Kupietz | 8879918 | 2026-08-24 09:22:33 +0300 | [diff] [blame] | 41 | #' On mobile browsers (touch devices), a button next to the fullscreen |
| 42 | #' toggle overlays the current slide with its speaker notes (plus the slide |
| 43 | #' title and, if present, the planned time from a timing comment), which is |
| 44 | #' useful for practicing a talk on a phone or tablet. It follows along as |
| 45 | #' you change slides and only appears if the deck contains notes at all. |
| 46 | #' |
| Marc Kupietz | 010db0b | 2026-08-26 09:56:45 +0300 | [diff] [blame] | 47 | #' Pressing `r` -- or, on touch devices, tapping the list button next to |
| 48 | #' the speaker notes button -- toggles a transcript view: a single |
| 49 | #' scrollable page containing every slide's content and speaker notes. |
| 50 | #' Text-to-speech ("read aloud") browser extensions cannot walk a |
| 51 | #' reveal.js deck, since hidden slides are not part of the visible page |
| 52 | #' text -- the transcript gives them something they can read from start |
| 53 | #' to finish. |
| Marc Kupietz | eaaa2b4 | 2026-08-26 09:41:27 +0300 | [diff] [blame] | 54 | #' |
| Marc Kupietz | b066e74 | 2026-08-23 09:57:06 +0300 | [diff] [blame] | 55 | #' ## Slide timing |
| 56 | #' |
| 57 | #' Speaker time can be planned per slide and per speaker by adding a comment |
| 58 | #' with a speaker code and the expected duration (in `MM:SS`, `HH:MM:SS`, or |
| 59 | #' plain seconds format) anywhere inside a slide: |
| 60 | #' |
| 61 | #' ```markdown |
| 62 | #' ## My slide title |
| 63 | #' |
| 64 | #' Some content |
| 65 | #' |
| 66 | #' <!-- MK 00:30 --> |
| 67 | #' ``` |
| 68 | #' |
| 69 | #' This means Marc Kupietz will need 30 seconds for that slide. For talks |
| 70 | #' presented by a single speaker, the speaker code can be omitted: |
| Marc Kupietz | 6b65c03 | 2026-08-25 09:43:28 +0300 | [diff] [blame] | 71 | #' `<!-- 00:30 -->`. Comments placed before the first heading are applied to |
| 72 | #' the title slide. |
| Marc Kupietz | b066e74 | 2026-08-23 09:57:06 +0300 | [diff] [blame] | 73 | #' |
| 74 | #' Typically you start from a known total time budget and adjust the |
| 75 | #' individual slides to it. You can set this budget yourself with the |
| 76 | #' reveal.js `totalTime` option (in seconds): |
| 77 | #' |
| 78 | #' ```yaml |
| 79 | #' output: |
| 80 | #' revealjs.ids::revealjs_presentation: |
| 81 | #' reveal_options: |
| 82 | #' totalTime: 3600 # one hour |
| 83 | #' ``` |
| 84 | #' |
| 85 | #' During rendering, comments are converted into `data-timing` attributes on |
| 86 | #' the slides' `<section>` elements (several speakers per slide are summed |
| 87 | #' up), and the calculated grand total is passed to reveal.js as the |
| 88 | #' `totalTime` config value. This activates the pacing timer in the |
| 89 | #' [speaker view](https://revealjs.com/speaker-view/), which shows how you |
| 90 | #' are doing relative to your plan. A summary of the total time per speaker |
| 91 | #' is printed during rendering. If the document sets `totalTime` or |
| 92 | #' `defaultTiming` itself (via `reveal_options`), those take precedence. |
| 93 | #' |
| 94 | #' The function [slide_timing()] computes these totals directly from an |
| 95 | #' `.Rmd` source file without rendering it. |
| 96 | #' |
| Marc Kupietz | de3c6c1 | 2026-08-30 14:40:33 +0300 | [diff] [blame] | 97 | #' ## Vertical content centering |
| 98 | #' |
| 99 | #' Slides with little content look lost when everything is glued below the |
| 100 | #' title bar, while packed slides must start at the top. reveal.js' own |
| 101 | #' `center` option cannot express this -- it also vertically centers the |
| 102 | #' headings. Instead, the body content of each slide (everything after the |
| 103 | #' heading block except speaker notes) is grouped and, whenever there is |
| 104 | #' free space, centered in the area between the heading and the footer: |
| 105 | #' slides that are too packed simply start directly below the heading and |
| 106 | #' overflow downwards, exactly as before. Centered content never reaches |
| 107 | #' into the footer; content too tall to fit above it may, as it always |
| 108 | #' could. Heading-only section-divider slides keep their own centered-title |
| 109 | #' layout. No configuration is needed and nothing changes about how slides |
| 110 | #' are authored. |
| 111 | #' |
| Marc Kupietz | de3ffa4 | 2026-08-30 13:47:57 +0300 | [diff] [blame] | 112 | #' ## Chapter numbering |
| 113 | #' |
| 114 | #' Like in the old Google Docs slide workflow, chapter headings (`#`) are |
| 115 | #' numbered automatically: the first chapter becomes "1. Introduction", the |
| 116 | #' second "2. Methods", and so on. References, appendix and thank-you |
| 117 | #' chapters (References/Literatur/Referenzen/Publikationen/ |
| 118 | #' Herausgeberschaften/Appendix/Anhang, and headings containing |
| 119 | #' "Thank you"/"Vielen Dank") keep their bare titles and are not counted. |
| 120 | #' Manually typed leading numbers (`# 2. Methods`) are stripped before |
| 121 | #' renumbering, so decks migrated from the old pipeline and repeated |
| 122 | #' numbering runs stay stable. The numbers are added when the presentation |
| 123 | #' is opened: the menu plugin and the transcript view show them, too, and |
| 124 | #' the overview slide's table of contents uses them as its ordered list's |
| 125 | #' enumeration. Decks rendered with `slide_level = 1` (one `#` heading per |
| 126 | #' slide) are left unnumbered -- there, headings denote slides, not |
| Marc Kupietz | 499082c | 2026-08-30 15:26:44 +0300 | [diff] [blame] | 127 | #' chapters. The numbering can be turned off with `chapter_numbering: false` |
| 128 | #' in the yaml header, or started at another number with e.g. |
| 129 | #' `chapter_numbering: 5` (useful for continuation decks). |
| Marc Kupietz | de3ffa4 | 2026-08-30 13:47:57 +0300 | [diff] [blame] | 130 | #' |
| Marc Kupietz | 4eb0320 | 2026-08-25 10:58:10 +0300 | [diff] [blame] | 131 | #' ## Overview slides |
| 132 | #' |
| 133 | #' Like in the original Google Docs slide workflow, a slide titled |
| 134 | #' "Overview" or "Überblick" is automatically turned into a table of |
| 135 | #' contents: its body content is replaced at presentation time with a |
| Marc Kupietz | de3ffa4 | 2026-08-30 13:47:57 +0300 | [diff] [blame] | 136 | #' clickable, ordered list of all `#` chapter headings, whose enumeration |
| 137 | #' repeats the chapter numbers. Adding |
| Marc Kupietz | 4eb0320 | 2026-08-25 10:58:10 +0300 | [diff] [blame] | 138 | #' `{data-overview-subheadings=true}` to the heading also includes the |
| 139 | #' `##` sub-headings below their chapters, laid out in two columns. |
| Marc Kupietz | de3ffa4 | 2026-08-30 13:47:57 +0300 | [diff] [blame] | 140 | #' References, appendix and thank-you chapters (References/Literatur/ |
| 141 | #' Literaturverzeichnis/Referenzen/Publikationen/Herausgeberschaften/ |
| 142 | #' Appendix/Anhang, and headings containing "Thank you"/"Vielen Dank") are |
| 143 | #' left out, together with their sub-slides. |
| Marc Kupietz | 4eb0320 | 2026-08-25 10:58:10 +0300 | [diff] [blame] | 144 | #' |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 145 | #' ### Search |
| Marc Kupietz | b9a8cba | 2026-08-28 06:51:28 +0300 | [diff] [blame] | 146 | #' |
| 147 | #' Activated by default: pressing `CTRL + SHIFT + F` shows a search box. |
| 148 | #' It will search in the whole presentation, and highlight matched words. The |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 149 | #' matches will also be highlighted in overview mode (pressing ESC to see all |
| 150 | #' slides in one scrollable view) |
| 151 | #' |
| Marc Kupietz | b9a8cba | 2026-08-28 06:51:28 +0300 | [diff] [blame] | 152 | #' ## Menu |
| 153 | #' |
| 154 | #' Activated by default: a slideout menu plugin for Reveal.js to quickly jump |
| 155 | #' to any slide by title. |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 156 | #' |
| 157 | #' Version `r version <- readLines(revealjs_lib_path("plugin", "menu", "VERSION"))` is |
| 158 | #' currently used and documentation for configurations can be found at |
| 159 | #' [denehyg/reveal.js-menu](https://github.com/denehyg/reveal.js-menu/blob/`r version`/README.md) |
| 160 | #' |
| 161 | #' ### Known limitations |
| 162 | #' |
| 163 | #' Some configurations cannot be modified in the current template: |
| 164 | #' |
| 165 | #' * `loadIcons: false` the fontawesome icons are loaded by \pkg{rmarkdown} |
| 166 | #' when this plugin is used |
| 167 | #' * `custom: false` |
| 168 | #' * `themes: false` |
| 169 | #' * `transitions: false` |
| 170 | |
| Marc Kupietz | b9a8cba | 2026-08-28 06:51:28 +0300 | [diff] [blame] | 171 | #' ## Chalkboard |
| 172 | #' |
| 173 | #' An opt-in plugin adding a chalkboard and slide annotation |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 174 | #' |
| 175 | #' Version `r version <- readLines(revealjs_lib_path("plugin", "chalkboard", "VERSION"))` is |
| 176 | #' currently used and documentation for configurations can be found at |
| 177 | #' [rajgoel/reveal.js-plugins](https://github.com/rajgoel/reveal.js-plugins/tree/`r version`/4.1.5/chalkboard) |
| 178 | #' |
| 179 | #' By default, chalkboard and annotations modes will be accessible using keyboard |
| 180 | #' shortcuts, respectively, pressing B, or pressing C. |
| 181 | #' In addition, buttons on the bottom left can be added by using the following |
| 182 | #' |
| 183 | #' ```yaml |
| 184 | #' reveal_plugins: |
| 185 | #' - chalkboard |
| 186 | #' reveal_options: |
| 187 | #' chalkboard: |
| 188 | #' toggleNotesButton: true |
| 189 | #' toggleChalkboardButton: true |
| 190 | #' ``` |
| Marc Kupietz | 59e95a6 | 2026-08-29 10:19:05 +0300 | [diff] [blame] | 191 | #' ## Title slide: QR code and additional logos |
| 192 | #' |
| 193 | #' Three optional yaml entries personalise the title slide for external |
| 194 | #' audiences (ported from \pkg{posterdown.ids}): |
| 195 | #' |
| 196 | #' * `website: <url>` -- a linked QR code pointing to the URL is placed in |
| 197 | #' the top left of the title slide. Uses the \pkg{qrcode} package. |
| 198 | #' * `partner_logo: <path-or-url>` -- when a presentation is given by |
| 199 | #' authors from two institutions, the partner institution's logo is shown |
| 200 | #' next to the IDS logo, in the top right of every slide. |
| 201 | #' * `funder_logo: <path-or-url>` -- a funder logo (e.g. "Text+") is placed |
| 202 | #' in the bottom left of the title slide, opposite the Leibniz |
| 203 | #' Gemeinschaft membership logo. It is lifted above the footer band on |
| 204 | #' print (pdf) pages. |
| 205 | #' |
| 206 | #' Local logo files (svg, png, jpg, gif, webp) are embedded in the html as |
| 207 | #' data URIs, so they do not need to be shipped with the presentation; http |
| 208 | #' URLs are used as-is. A QR code anywhere else on a slide can be produced |
| 209 | #' with [qrlink()] from inline R code. The navigation chrome (arrows, slide |
| 210 | #' number, menu button) is hidden on the title slide for a bare first |
| 211 | #' impression. |
| 212 | #' |
| Marc Kupietz | ad0f24b | 2026-08-23 10:09:05 +0300 | [diff] [blame] | 213 | #' ## Bibliography and citations |
| 214 | #' |
| 215 | #' Documents with a `bibliography:` in their YAML header are formatted with |
| 216 | #' the bundled IDS citation style (`ids.csl`, based on the style developed |
| 217 | #' for ICLC-10 2023 in Mannheim) by default. To use a different style, |
| 218 | #' specify it as usual with `csl:` in the YAML header. |
| 219 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 220 | #' @inheritParams rmarkdown::beamer_presentation |
| 221 | #' @inheritParams rmarkdown::pdf_document |
| 222 | #' @inheritParams rmarkdown::html_document |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 223 | #' |
| christophe dervieux | d26add3 | 2021-09-23 16:55:00 +0200 | [diff] [blame] | 224 | #' @param center `TRUE` to vertically center content on slides |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 225 | #' @param slide_level Level of heading to denote individual slides. If |
| christophe dervieux | d26add3 | 2021-09-23 16:55:00 +0200 | [diff] [blame] | 226 | #' `slide_level` is 2 (the default), a two-dimensional layout will be |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 227 | #' produced, with level 1 headers building horizontally and level 2 headers |
| 228 | #' building vertically. It is not recommended that you use deeper nesting of |
| JJ Allaire | 4c17805 | 2016-01-30 19:35:39 -0500 | [diff] [blame] | 229 | #' section levels with reveal.js. |
| Marc Kupietz | 499082c | 2026-08-30 15:26:44 +0300 | [diff] [blame] | 230 | #' @param chapter_numbering `TRUE` (the default) numbers the `#` chapter |
| 231 | #' headings automatically ("1. Introduction", "2. Methods", ...), skipping |
| 232 | #' references, appendix and thank-you chapters. `FALSE` turns the numbering |
| 233 | #' off -- headings keep exactly what was typed, including any manually |
| 234 | #' typed numbers. A number starts the enumeration at that value: |
| 235 | #' `chapter_numbering = 5` numbers the first chapter "5." (useful for |
| 236 | #' continuation decks). |
| Marc Kupietz | 9fdf0f7 | 2026-08-28 07:04:25 +0300 | [diff] [blame] | 237 | #' @param theme Visual theme. The dedicated IDS corporate design theme |
| 238 | #' ("ids") is the default and the only supported theme. |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 239 | #' @param transition Slide transition ( |
| 240 | #' `r (trans <- knitr::combine_words(setdiff(revealjs_transitions(), "default"), before = '"', and = " or "))` |
| 241 | #' ) |
| 242 | #' @param background_transition Slide background-transition ( |
| 243 | #' `r trans` |
| 244 | #' ) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 245 | #' @param reveal_options Additional options to specify for reveal.js (see |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 246 | #' <https://revealjs.com/config/> for details). Options for plugins can also |
| 247 | #' be passed, using plugin name as first level key (e.g `list(slideNumber = |
| 248 | #' FALSE, menu = list(number = TRUE))`). |
| JJ Allaire | 35c0b49 | 2017-02-10 09:30:24 -0500 | [diff] [blame] | 249 | #' @param reveal_plugins Reveal plugins to include. Available plugins include |
| Marc Kupietz | 03dbc5d | 2026-08-21 15:44:25 +0200 | [diff] [blame] | 250 | #' "notes", "search", "zoom", "chalkboard", and "menu". Defaults to |
| 251 | #' `c("notes", "search", "menu", "zoom")`; pass `NULL` to render without |
| 252 | #' any plugins. Note that `self_contained` must be set to `FALSE` in order |
| 253 | #' to use Reveal plugins. |
| Marc Kupietz | 725acd1 | 2026-08-28 14:03:21 +0300 | [diff] [blame] | 254 | #' @param df_print Method used to print data frames in the document. The |
| 255 | #' default, `"kable"`, renders data frames as plain HTML tables styled by |
| 256 | #' the presentation theme, so that results look reasonable on slides without |
| 257 | #' any extra code. Since `"kable"` prints all rows, consider showing only |
| 258 | #' `head(x)` on slides with many-rowed results. Other supported methods are |
| 259 | #' `"default"` (plain text output), `"tibble"`, and `"paged"` (an |
| 260 | #' interactive paged table, see [rmarkdown::html_document()]). |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 261 | #' @param template Pandoc template to use for rendering. Pass "default" to use |
| christophe dervieux | d26add3 | 2021-09-23 16:55:00 +0200 | [diff] [blame] | 262 | #' the rmarkdown package default template; pass `NULL` to use pandoc's |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 263 | #' built-in template; pass a path to use a custom template that you've |
| 264 | #' created. Note that if you don't use the "default" template then some |
| christophe dervieux | d26add3 | 2021-09-23 16:55:00 +0200 | [diff] [blame] | 265 | #' features of `revealjs_presentation` won't be available (see the |
| JJ Allaire | 4c17805 | 2016-01-30 19:35:39 -0500 | [diff] [blame] | 266 | #' Templates section below for more details). |
| JJ Allaire | 35c0b49 | 2017-02-10 09:30:24 -0500 | [diff] [blame] | 267 | #' @param extra_dependencies Additional function arguments to pass to the base R |
| 268 | #' Markdown HTML output formatter [rmarkdown::html_document_base()]. |
| JJ Allaire | 8d1c2f4 | 2016-01-30 14:56:45 -0500 | [diff] [blame] | 269 | #' @param ... Ignored |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 270 | #' |
| christophe dervieux | d26add3 | 2021-09-23 16:55:00 +0200 | [diff] [blame] | 271 | #' @return R Markdown output format to pass to [rmarkdown::render()] |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 272 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 273 | #' @examples |
| 274 | #' \dontrun{ |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 275 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 276 | #' library(rmarkdown) |
| Marc Kupietz | e195cea | 2026-08-17 13:17:33 +0200 | [diff] [blame] | 277 | #' library(revealjs.ids) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 278 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 279 | #' # simple invocation |
| 280 | #' render("pres.Rmd", revealjs_presentation()) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 281 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 282 | #' # specify an option for incremental rendering |
| 283 | #' render("pres.Rmd", revealjs_presentation(incremental = TRUE)) |
| 284 | #' } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 285 | #' |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 286 | #' @export |
| 287 | revealjs_presentation <- function(incremental = FALSE, |
| 288 | center = FALSE, |
| JJ Allaire | 4c17805 | 2016-01-30 19:35:39 -0500 | [diff] [blame] | 289 | slide_level = 2, |
| Marc Kupietz | 499082c | 2026-08-30 15:26:44 +0300 | [diff] [blame] | 290 | chapter_numbering = TRUE, |
| Christophe Dervieux | aa008e4 | 2021-09-23 16:52:37 +0200 | [diff] [blame] | 291 | toc = FALSE, |
| 292 | toc_depth = 3, |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 293 | fig_width = 8, |
| 294 | fig_height = 6, |
| 295 | fig_retina = if (!fig_caption) 2, |
| 296 | fig_caption = FALSE, |
| Marc Kupietz | f8d5ff1 | 2023-10-09 18:58:09 +0200 | [diff] [blame] | 297 | self_contained = FALSE, |
| 298 | theme = "ids", |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 299 | transition = "convex", |
| 300 | background_transition = "fade", |
| JJ Allaire | 37f45b7 | 2016-01-30 18:17:45 -0500 | [diff] [blame] | 301 | reveal_options = NULL, |
| Marc Kupietz | 03dbc5d | 2026-08-21 15:44:25 +0200 | [diff] [blame] | 302 | reveal_plugins = c("notes", "search", "menu", "zoom"), |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 303 | highlight = "default", |
| Marc Kupietz | 725acd1 | 2026-08-28 14:03:21 +0300 | [diff] [blame] | 304 | df_print = "kable", |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 305 | mathjax = "default", |
| 306 | template = "default", |
| JJ Allaire | fad5523 | 2015-10-19 07:47:26 -0400 | [diff] [blame] | 307 | css = NULL, |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 308 | includes = NULL, |
| 309 | keep_md = FALSE, |
| 310 | lib_dir = NULL, |
| 311 | pandoc_args = NULL, |
| JJ Allaire | 375805c | 2016-11-15 08:56:43 -0500 | [diff] [blame] | 312 | extra_dependencies = NULL, |
| Atsushi Yasumoto | 0bf4444 | 2020-02-15 00:08:30 +0900 | [diff] [blame] | 313 | md_extensions = NULL, |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 314 | ...) { |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 315 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 316 | # base pandoc options for all reveal.js output |
| 317 | args <- c() |
| Christophe Dervieux | aa008e4 | 2021-09-23 16:52:37 +0200 | [diff] [blame] | 318 | |
| 319 | # table of contents |
| 320 | args <- c(args, pandoc_toc_args(toc, toc_depth)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 321 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 322 | # template path and assets |
| JJ Allaire | a8c414b | 2016-01-30 14:36:53 -0500 | [diff] [blame] | 323 | if (identical(template, "default")) { |
| christophe dervieux | 92fa469 | 2021-09-21 16:15:17 +0200 | [diff] [blame] | 324 | default_template <- reveal_resources("default.html") |
| JJ Allaire | a8c414b | 2016-01-30 14:36:53 -0500 | [diff] [blame] | 325 | args <- c(args, "--template", pandoc_path_arg(default_template)) |
| 326 | } else if (!is.null(template)) { |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 327 | args <- c(args, "--template", pandoc_path_arg(template)) |
| JJ Allaire | a8c414b | 2016-01-30 14:36:53 -0500 | [diff] [blame] | 328 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 329 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 330 | # incremental |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 331 | if (incremental) args <- c(args, "--incremental") |
| 332 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 333 | # centering |
| JJ Allaire | 40fec33 | 2016-01-30 16:54:51 -0500 | [diff] [blame] | 334 | args <- c(args, pandoc_variable_arg("center", jsbool(center))) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 335 | |
| JJ Allaire | 4c17805 | 2016-01-30 19:35:39 -0500 | [diff] [blame] | 336 | # slide level |
| JJ Allaire | c58a6c4 | 2016-03-30 23:45:21 -0400 | [diff] [blame] | 337 | args <- c(args, "--slide-level", as.character(slide_level)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 338 | |
| Marc Kupietz | 499082c | 2026-08-30 15:26:44 +0300 | [diff] [blame] | 339 | # chapter numbering: FALSE disables the automatic "1. ", "2. " prefixes on |
| 340 | # chapter headings; a number starts the enumeration at that value (useful |
| 341 | # e.g. for continuation decks). TRUE, the default, numbers from 1. |
| 342 | if (identical(chapter_numbering, FALSE)) { |
| 343 | args <- c(args, pandoc_variable_arg("chapter-numbering-off")) |
| 344 | } else if (is.numeric(chapter_numbering)) { |
| 345 | if (chapter_numbering != 1) { |
| 346 | args <- c(args, pandoc_variable_arg( |
| 347 | "chapter-numbering-start", as.integer(chapter_numbering) |
| 348 | )) |
| 349 | } |
| 350 | } else if (!isTRUE(chapter_numbering)) { |
| 351 | stop("chapter_numbering must be TRUE, FALSE or a number", call. = FALSE) |
| 352 | } |
| 353 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 354 | # theme |
| 355 | theme <- match.arg(theme, revealjs_themes()) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 356 | if (identical(theme, "default")) { |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 357 | theme <- "simple" |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 358 | } else if (identical(theme, "dark")) { |
| JJ Allaire | 6da1bb6 | 2016-01-30 14:28:39 -0500 | [diff] [blame] | 359 | theme <- "black" |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 360 | } |
| 361 | if (theme %in% c("blood", "moon", "night", "black")) { |
| christophe dervieux | 062940d | 2021-09-21 16:26:14 +0200 | [diff] [blame] | 362 | args <- c(args, pandoc_variable_arg("theme-dark")) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 363 | } |
| christophe dervieux | 1ebd513 | 2021-09-22 08:47:21 +0200 | [diff] [blame] | 364 | args <- c(args, pandoc_variable_arg("theme", theme)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 365 | |
| Marc Kupietz | 7c8f7de | 2023-10-07 11:42:29 +0200 | [diff] [blame] | 366 | if (theme == "ids") { |
| 367 | args <- c(args, pandoc_variable_arg("theme-ids")) |
| 368 | fig_height = 7 |
| 369 | fig_width = 12 |
| 370 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 371 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 372 | # transition |
| Marc Kupietz | 9d96fda | 2026-08-11 16:55:13 +0200 | [diff] [blame] | 373 | if (missing(transition) && identical(theme, "ids")) { |
| 374 | # IDS theme: slide the slides in instead of rotating them (reveal.js' |
| 375 | # own default, convex), unless the user explicitly asked for something |
| 376 | # else. The formal default has to stay "convex" for the other themes. |
| 377 | transition <- "slide" |
| 378 | } |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 379 | transition <- match.arg(transition, revealjs_transitions()) |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 380 | if (identical(transition, "default")) { |
| 381 | # revealjs default is convex |
| 382 | transition <- "convex" |
| 383 | } |
| christophe dervieux | 062940d | 2021-09-21 16:26:14 +0200 | [diff] [blame] | 384 | args <- c(args, pandoc_variable_arg("transition", transition)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 385 | |
| junkka | d55cff0 | 2015-03-15 22:27:03 +0100 | [diff] [blame] | 386 | # background_transition |
| 387 | background_transition <- match.arg(background_transition, revealjs_transitions()) |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 388 | if (identical(background_transition, "default")) { |
| 389 | # revealjs default is fade |
| 390 | background_transition <- "fade" |
| 391 | } |
| christophe dervieux | 062940d | 2021-09-21 16:26:14 +0200 | [diff] [blame] | 392 | args <- c(args, pandoc_variable_arg("backgroundTransition", background_transition)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 393 | |
| JJ Allaire | 4ae486f | 2016-03-23 06:08:42 -0400 | [diff] [blame] | 394 | # use history |
| 395 | args <- c(args, pandoc_variable_arg("history", "true")) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 396 | |
| Marc Kupietz | a0f8f68 | 2026-08-08 14:13:11 +0200 | [diff] [blame] | 397 | # The IDS corporate design puts the orange bar flush against the top left |
| 398 | # corner of the slide. reveal.js defaults to margin = 0.04, i.e. it keeps 4% |
| 399 | # of the display empty around the content, which would leave a white border |
| 400 | # above and to the left of the bar. Default to 0 instead, unless the document |
| 401 | # asks for a margin of its own via reveal_options. |
| 402 | if (!is.list(reveal_options) || is.null(reveal_options[["margin"]])) { |
| 403 | args <- c(args, pandoc_variable_arg("margin", "0")) |
| 404 | } |
| 405 | |
| JJ Allaire | 37f45b7 | 2016-01-30 18:17:45 -0500 | [diff] [blame] | 406 | # additional reveal options |
| 407 | if (is.list(reveal_options)) { |
| JJ Allaire | 375805c | 2016-11-15 08:56:43 -0500 | [diff] [blame] | 408 | for (option in names(reveal_options)) { |
| JJ Allaire | 064552c | 2017-02-10 10:28:41 -0500 | [diff] [blame] | 409 | # special handling for nested options |
| 410 | if (option %in% c("chalkboard", "menu")) { |
| 411 | nested_options <- reveal_options[[option]] |
| 412 | for (nested_option in names(nested_options)) { |
| Christophe Dervieux | 2f01dc9 | 2021-09-22 09:37:18 +0200 | [diff] [blame] | 413 | args <- c(args, |
| 414 | process_reveal_option( |
| 415 | paste0(option, "-", nested_option), |
| 416 | nested_options[[nested_option]] |
| 417 | ) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 418 | ) |
| JJ Allaire | 375805c | 2016-11-15 08:56:43 -0500 | [diff] [blame] | 419 | } |
| Christophe Dervieux | 2f01dc9 | 2021-09-22 09:37:18 +0200 | [diff] [blame] | 420 | } else { |
| 421 | # standard top-level options |
| 422 | args <- c(args, process_reveal_option(option, reveal_options[[option]])) |
| JJ Allaire | 375805c | 2016-11-15 08:56:43 -0500 | [diff] [blame] | 423 | } |
| JJ Allaire | 37f45b7 | 2016-01-30 18:17:45 -0500 | [diff] [blame] | 424 | } |
| 425 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 426 | |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 427 | # reveal plugins |
| 428 | if (is.character(reveal_plugins)) { |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 429 | |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 430 | # validate that we need to use self_contained for plugins |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 431 | if (self_contained) { |
| Marc Kupietz | 03dbc5d | 2026-08-21 15:44:25 +0200 | [diff] [blame] | 432 | if (missing(reveal_plugins)) { |
| 433 | # the default plugin set collided with an explicitly requested |
| 434 | # self_contained render -- drop the defaults instead of failing |
| 435 | warning("Reveal plugins require self_contained: false -- ", |
| 436 | "rendering without the default plugins.", |
| 437 | call. = FALSE |
| 438 | ) |
| 439 | reveal_plugins <- character(0) |
| 440 | } else { |
| 441 | stop("Using reveal_plugins requires self_contained: false") |
| 442 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 443 | } |
| 444 | |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 445 | # validate specified plugins are supported |
| JJ Allaire | 064552c | 2017-02-10 10:28:41 -0500 | [diff] [blame] | 446 | supported_plugins <- c("notes", "search", "zoom", "chalkboard", "menu") |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 447 | invalid_plugins <- setdiff(reveal_plugins, supported_plugins) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 448 | if (length(invalid_plugins) > 0) { |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 449 | stop("The following plugin(s) are not supported: ", |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 450 | paste(invalid_plugins, collapse = ", "), |
| 451 | call. = FALSE |
| 452 | ) |
| 453 | } |
| 454 | |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 455 | # add plugins |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 456 | if ("chalkboard" %in% reveal_plugins) { |
| 457 | # chalkboard require customcontrols so we add it to activate in the template |
| 458 | reveal_plugins <- c(reveal_plugins, "customcontrols") |
| 459 | } |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 460 | sapply(reveal_plugins, function(plugin) { |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 461 | args <<- c(args, pandoc_variable_arg(paste0("plugin-", plugin))) |
| 462 | if (plugin %in% c("customcontrols", "menu")) { |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 463 | extra_dependencies <<- append( |
| 464 | extra_dependencies, |
| 465 | list(rmarkdown::html_dependency_font_awesome()) |
| 466 | ) |
| JJ Allaire | 375805c | 2016-11-15 08:56:43 -0500 | [diff] [blame] | 467 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 468 | }) |
| JJ Allaire | 82a8dee | 2016-07-12 10:25:36 -0400 | [diff] [blame] | 469 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 470 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 471 | # content includes |
| 472 | args <- c(args, includes_to_pandoc_args(includes)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 473 | |
| JJ Allaire | fad5523 | 2015-10-19 07:47:26 -0400 | [diff] [blame] | 474 | # additional css |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 475 | for (css_file in css) { |
| JJ Allaire | fad5523 | 2015-10-19 07:47:26 -0400 | [diff] [blame] | 476 | args <- c(args, "--css", pandoc_path_arg(css_file)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 477 | } |
| 478 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 479 | # pre-processor for arguments that may depend on the name of the |
| 480 | # the input file (e.g. ones that need to copy supporting files) |
| 481 | pre_processor <- function(metadata, input_file, runtime, knit_meta, files_dir, |
| 482 | output_dir) { |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 483 | |
| JJ Allaire | e60feb2 | 2016-01-30 18:28:47 -0500 | [diff] [blame] | 484 | # we don't work with runtime shiny |
| 485 | if (identical(runtime, "shiny")) { |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 486 | stop("revealjs_presentation is not compatible with runtime 'shiny'", |
| 487 | call. = FALSE |
| 488 | ) |
| JJ Allaire | e60feb2 | 2016-01-30 18:28:47 -0500 | [diff] [blame] | 489 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 490 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 491 | # use files_dir as lib_dir if not explicitly specified |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 492 | if (is.null(lib_dir)) { |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 493 | lib_dir <- files_dir |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 494 | } |
| 495 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 496 | # extra args |
| 497 | args <- c() |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 498 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 499 | # reveal.js |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 500 | revealjs_path <- revealjs_lib_path() |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 501 | if (!self_contained || identical(.Platform$OS.type, "windows")) { |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 502 | revealjs_path <- relative_to( |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 503 | output_dir, render_supporting_files(revealjs_path, lib_dir) |
| 504 | ) |
| 505 | } else { |
| JJ Allaire | eea3bca | 2016-07-13 12:42:01 -0400 | [diff] [blame] | 506 | revealjs_path <- pandoc_path_arg(revealjs_path) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 507 | } |
| christophe dervieux | 062940d | 2021-09-21 16:26:14 +0200 | [diff] [blame] | 508 | args <- c(args, pandoc_variable_arg("revealjs-url", revealjs_path)) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 509 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 510 | # highlight |
| 511 | args <- c(args, pandoc_highlight_args(highlight, default = "pygments")) |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 512 | |
| Marc Kupietz | 59e95a6 | 2026-08-29 10:19:05 +0300 | [diff] [blame] | 513 | # website entry: place a linked QR code (inline SVG) in the top left of |
| 514 | # the title slide |
| 515 | if (!is.null(metadata$website)) { |
| 516 | args <- c(args, pandoc_variable_arg("website-qr", qrlink(metadata$website))) |
| 517 | } |
| 518 | |
| 519 | # partner / funder institution logos: local files are inlined as data |
| 520 | # URIs so they resolve correctly in CSS and stay embedded in the output |
| 521 | if (!is.null(metadata$partner_logo)) { |
| 522 | args <- c(args, pandoc_variable_arg("partner-logo-src", logo_uri(metadata$partner_logo))) |
| 523 | } |
| 524 | if (!is.null(metadata$funder_logo)) { |
| 525 | args <- c(args, pandoc_variable_arg("funder-logo-src", logo_uri(metadata$funder_logo))) |
| 526 | } |
| 527 | |
| Marc Kupietz | ad0f24b | 2026-08-23 10:09:05 +0300 | [diff] [blame] | 528 | # default to the bundled IDS citation style unless the document |
| 529 | # specifies a style of its own |
| 530 | if (is.null(metadata$csl)) { |
| 531 | args <- c(args, "--csl", pandoc_path_arg(reveal_resources("ids.csl"))) |
| 532 | } |
| 533 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 534 | # return additional args |
| 535 | args |
| 536 | } |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 537 | |
| Marc Kupietz | b066e74 | 2026-08-23 09:57:06 +0300 | [diff] [blame] | 538 | # post-processor converting <!-- MK 00:30 --> speaker timing comments into |
| 539 | # data-timing attributes on the enclosing sections (activating the pacing |
| 540 | # timer of the notes plugin) and reporting per-speaker totals |
| 541 | post_processor <- function(metadata, input_file, output_file, clean, verbose) { |
| 542 | lines <- readLines(output_file, warn = FALSE, encoding = "UTF-8") |
| Marc Kupietz | 6b65c03 | 2026-08-25 09:43:28 +0300 | [diff] [blame] | 543 | lines <- merge_title_slide_notes(lines) |
| Marc Kupietz | b066e74 | 2026-08-23 09:57:06 +0300 | [diff] [blame] | 544 | result <- apply_timing_attributes(lines) |
| 545 | comments <- attr(result, "comments") |
| 546 | if (nrow(comments) > 0) { |
| 547 | result <- inject_total_time(result, sum(comments$seconds)) |
| 548 | writeLines(enc2utf8(result), output_file, useBytes = TRUE) |
| 549 | message(timing_report_message(comments)) |
| 550 | } |
| 551 | output_file |
| 552 | } |
| 553 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 554 | # return format |
| 555 | output_format( |
| 556 | knitr = knitr_options_html(fig_width, fig_height, fig_retina, keep_md), |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 557 | pandoc = pandoc_options( |
| 558 | to = "revealjs", |
| christophe dervieux | ad3a575 | 2021-09-23 10:24:09 +0200 | [diff] [blame] | 559 | from = from_rmarkdown(fig_caption, md_extensions), |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 560 | args = args |
| 561 | ), |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 562 | keep_md = keep_md, |
| 563 | clean_supporting = self_contained, |
| Marc Kupietz | 725acd1 | 2026-08-28 14:03:21 +0300 | [diff] [blame] | 564 | df_print = df_print, |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 565 | pre_processor = pre_processor, |
| Marc Kupietz | b066e74 | 2026-08-23 09:57:06 +0300 | [diff] [blame] | 566 | post_processor = post_processor, |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 567 | base_format = html_document_base( |
| christophe dervieux | 0acc6c9 | 2021-09-23 11:18:18 +0200 | [diff] [blame] | 568 | lib_dir = lib_dir, |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 569 | self_contained = self_contained, |
| 570 | mathjax = mathjax, |
| 571 | pandoc_args = pandoc_args, |
| 572 | extra_dependencies = extra_dependencies, |
| 573 | ... |
| 574 | ) |
| 575 | ) |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | revealjs_themes <- function() { |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 579 | c( |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 580 | "default", # not used by reveal |
| Marc Kupietz | a737b1b | 2023-10-07 09:32:20 +0200 | [diff] [blame] | 581 | "ids", |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 582 | "simple", |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 583 | "dark", # our alias for black |
| 584 | "black", |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 585 | "sky", |
| 586 | "beige", |
| 587 | "serif", |
| 588 | "solarized", |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 589 | "blood", |
| 590 | "moon", |
| junkka | 77fbf08 | 2015-03-15 22:25:47 +0100 | [diff] [blame] | 591 | "night", |
| junkka | 77fbf08 | 2015-03-15 22:25:47 +0100 | [diff] [blame] | 592 | "league", |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 593 | "white" |
| 594 | ) |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 595 | } |
| 596 | |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 597 | revealjs_transitions <- function() { |
| junkka | 77fbf08 | 2015-03-15 22:25:47 +0100 | [diff] [blame] | 598 | c( |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 599 | "default", # not used by reveal |
| 600 | "convex", |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 601 | "fade", |
| junkka | 77fbf08 | 2015-03-15 22:25:47 +0100 | [diff] [blame] | 602 | "slide", |
| junkka | 77fbf08 | 2015-03-15 22:25:47 +0100 | [diff] [blame] | 603 | "concave", |
| Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 604 | "zoom", |
| 605 | "none" |
| christophe dervieux | f9bae67 | 2021-09-21 16:20:24 +0200 | [diff] [blame] | 606 | ) |
| JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 607 | } |