Search code examples
rslideshowweb-publishing

Publishing a RevealJS presentation to RStudio Connect with plugins?


I've developed presentations using JJ Allaire's revealjs package (version 0.9) without issues in RStudio IDE (version 1.4.1103.4, Platform: x86_64-redhat-linux-gnu (64-bit), R version 3.6.0). However, I get the following error when publishing to RStudio Connect with the source code, if I add plugins.

Error in (function (incremental = FALSE, center = FALSE, slide_level = 2, :
04/03 14:25:02.921 (GMT)
Using reveal_plugins requires self_contained: false
04/03 14:25:02.921 (GMT)
Calls: local ... <Anonymous> -> create_output_format -> do.call -> <Anonymous>

Values for incremental and self-contained are set to TRUE and FALSE, respectively in my YAML, so the error isn't making sense to me. It seems I have two options for publishing successfully:

  1. With plug-ins, but without the source code
  2. With source code, but without plug-ins

I've included a simple example of the source code, below.

---
title: "My Title"
author: "Author Name"
date:  "`r Sys.Date()`"
output:
  revealjs::revealjs_presentation:
    incremental: true
    self_contained: false
    reveal_plugins: ["notes", "chalkboard", "menu"]
link-citations: yes
---

## Slide 1

- Bullet 1
- Bullet 2

I really like revealjs, but I'm flummoxed. Any help is much appreciated.


Solution

  • Circling back with the (paraphrased) answer I received in response to the GH issue I posted here: https://github.com/rstudio/revealjs/issues/86.

    Credit: Christoph Dervieux

    The problem is in how RStudio Connect deals with the revealjs constraint on the self_contained option in the YAML header.

    When using plugins, self_contained must be set to FALSE. However, RStudio Connect enforces self_contained: true when publishing to the server. RStudio Connect will render the document on the server without mentioning that it also overwrote the self_contained setting in the markdown's YAML header, changing self_contained: FALSE to self_contained: TRUE behind the scenes. This explains why the plugins work locally, but not when published to the server.

    The suggested workaround, which I've not yet tried, is to build the slide deck on the local server, then publish the folder and files (HTML + resources) vs. having RStudio Connect try and render the markdown.

    For now, I'm pretty happy rendering my slides locally, with plugins. Will add a comment with with any new information. But for now, looks like this question is answered.