Fairly recently, RStudio has added support for beautiful reveal.js-based HTML presentations generated from RMarkdown (with some extensions). These are different from earlier HTML presentation formats provided by the rmarkdown
R package, which relied on ioslides or Slidy.
Is it possible to compile such a presentation to HTML without having recourse to RStudio? I.e. is there a pure R function which will, given an R presentation source file, generate the same result as the IDE?
P.S. I suppose the underlying R package doing the conversion is revealjs
by JJ Allaire, but on its own, it doesn't recognize some of the syntax extensions (e.g. those for customizing appearance by putting css: custom.css
under the title of the first slide), which makes me think there must be an additional wrapper around it.
You can use the standard rmarkdown::render()
function with the revealjs::revealjs_presentation
format in the YAML header. Resources like custom.css
are referenced relative to the Rmd location so there is no need to specify these within the render()
step.
It's not a drop-in replacement though. The revealjs
package, as it's available from CRAN, ships with a different (newer) version of the reveal.js library than the one used internally by RStudio (3.2 vs 2.4 as of March 8th, 2016). The default settings (e.g. transitions) are also different, so they need tweaking.
Circumspection is also warranted with the version of pandoc used as the workhorse for the Markdown → HTML conversion, as RStudio may internally be using an older one with different templates. All of this means that you may need to rework your customizations (e.g. css tweaks).
There are also syntax differences -- the metadata can't go under the first heading of the presentation (i.e. the title):
Presentation title
==================
author: Foo Bar
css: custom.css
Instead, they have to be put in a traditional RMarkdown YAML header:
---
author: Foo Bar
css: custom.css
---
I'm not sure whether per-slide special settings like incremental: true
(which are put under the respective slide's heading in the RPresentation format) are recognized at all.