enable notes, search, menu and zoom plugins by default
reveal_plugins now defaults to c("notes", "search", "menu", "zoom");
pass NULL to render without plugins. Existing self_contained decks keep
working: the default set is dropped with a warning there instead of
triggering the hard stop, which still applies to explicitly requested
plugins.
Change-Id: I9041861a6914886e0c32ab5e37b8c4f55a5576c3
diff --git a/R/revealjs_presentation.R b/R/revealjs_presentation.R
index bdc4153..21212a7 100644
--- a/R/revealjs_presentation.R
+++ b/R/revealjs_presentation.R
@@ -100,9 +100,10 @@
#' be passed, using plugin name as first level key (e.g `list(slideNumber =
#' FALSE, menu = list(number = TRUE))`).
#' @param reveal_plugins Reveal plugins to include. Available plugins include
-#' "notes", "search", "zoom", "chalkboard", and "menu". Note that
-#' `self_contained` must be set to `FALSE` in order to use Reveal
-#' plugins.
+#' "notes", "search", "zoom", "chalkboard", and "menu". Defaults to
+#' `c("notes", "search", "menu", "zoom")`; pass `NULL` to render without
+#' any plugins. Note that `self_contained` must be set to `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 `NULL` to use pandoc's
#' built-in template; pass a path to use a custom template that you've
@@ -143,7 +144,7 @@
transition = "convex",
background_transition = "fade",
reveal_options = NULL,
- reveal_plugins = NULL,
+ reveal_plugins = c("notes", "search", "menu", "zoom"),
highlight = "default",
mathjax = "default",
template = "default",
@@ -257,7 +258,17 @@
# validate that we need to use self_contained for plugins
if (self_contained) {
- stop("Using reveal_plugins requires self_contained: false")
+ if (missing(reveal_plugins)) {
+ # the default plugin set collided with an explicitly requested
+ # self_contained render -- drop the defaults instead of failing
+ warning("Reveal plugins require self_contained: false -- ",
+ "rendering without the default plugins.",
+ call. = FALSE
+ )
+ reveal_plugins <- character(0)
+ } else {
+ stop("Using reveal_plugins requires self_contained: false")
+ }
}
# validate specified plugins are supported
diff --git a/man/revealjs_presentation.Rd b/man/revealjs_presentation.Rd
index 0d291c2..c1c1ff2 100644
--- a/man/revealjs_presentation.Rd
+++ b/man/revealjs_presentation.Rd
@@ -19,7 +19,7 @@
transition = "convex",
background_transition = "fade",
reveal_options = NULL,
- reveal_plugins = NULL,
+ reveal_plugins = c("notes", "search", "menu", "zoom"),
highlight = "default",
mathjax = "default",
template = "default",
@@ -84,9 +84,10 @@
be passed, using plugin name as first level key (e.g \code{list(slideNumber = FALSE, menu = list(number = TRUE))}).}
\item{reveal_plugins}{Reveal plugins to include. Available plugins include
-"notes", "search", "zoom", "chalkboard", and "menu". Note that
-\code{self_contained} must be set to \code{FALSE} in order to use Reveal
-plugins.}
+"notes", "search", "zoom", "chalkboard", and "menu". Defaults to
+\code{c("notes", "search", "menu", "zoom")}; pass \code{NULL} to render without
+any plugins. Note that \code{self_contained} must be set to \code{FALSE} in order
+to use Reveal plugins.}
\item{highlight}{Syntax highlighting style passed to Pandoc.
@@ -233,7 +234,7 @@
\dontrun{
library(rmarkdown)
-library(revealjs)
+library(revealjs.ids)
# simple invocation
render("pres.Rmd", revealjs_presentation())