support for zoom, search, and notes reveal.js plugins
diff --git a/R/revealjs_presentation.R b/R/revealjs_presentation.R
index e970326..3778568 100644
--- a/R/revealjs_presentation.R
+++ b/R/revealjs_presentation.R
@@ -21,6 +21,9 @@
#' @param reveal_options Additional options to specify for reveal.js (see
#' \href{https://github.com/hakimel/reveal.js#configuration}{https://github.com/hakimel/reveal.js#configuration}
#' for details).
+#' @param reveal_plugins Reveal plugins to include. Available plugins include "notes",
+#' "search", and "zoom". Note that \code{self_contained} must be set to
+#' \code{FALSE} in order to use Reveal plugins.
#' @param template Pandoc template to use for rendering. Pass "default" to use
#' the rmarkdown package default template; pass \code{NULL} to use pandoc's
#' built-in template; pass a path to use a custom template that you've
@@ -69,6 +72,7 @@
transition = "default",
background_transition = "default",
reveal_options = NULL,
+ reveal_plugins = NULL,
highlight = "default",
mathjax = "default",
template = "default",
@@ -142,6 +146,26 @@
}
}
+ # reveal plugins
+ if (is.character(reveal_plugins)) {
+
+ # validate that we need to use self_contained for plugins
+ if (self_contained)
+ stop("Using reveal_plugins requires self_contained: false")
+
+ # validate specified plugins are supported
+ supported_plugins <- c("notes", "search", "zoom")
+ invalid_plugins <- setdiff(reveal_plugins, supported_plugins)
+ if (length(invalid_plugins) > 0)
+ stop("The following plugin(s) are not supported: ",
+ paste(invalid_plugins, collapse = ", "), call. = FALSE)
+
+ # add plugins
+ sapply(reveal_plugins, function(plugin) {
+ args <<- c(args, pandoc_variable_arg(paste0("plugin-", plugin), "1"))
+ })
+ }
+
# content includes
args <- c(args, includes_to_pandoc_args(includes))