Adding support to ioslides_presentation and slidy_presentation
diff --git a/R/print.R b/R/print.R
index 279dee7..de5f75b 100644
--- a/R/print.R
+++ b/R/print.R
@@ -13,6 +13,7 @@
print(html_result)
}
+#' @export
html_dependency_kePrint <- function() {
htmlDependency(name = "kePrint",
version = "0.0.1",
@@ -22,9 +23,23 @@
}
#' @export
+html_dependency_bsTable <- function() {
+ htmlDependency(name = "bsTable",
+ version = "3.3.7",
+ src = system.file("bootstrapTable-3.3.7",
+ package = "kableExtra"),
+ stylesheet = "bootstrapTable.min.css")
+}
+
+#' @export
knit_print.kableExtra <- function(x, ...) {
x <- paste0(x, "\n\n")
- asis_output(x)
+ meta_list <- list(html_dependency_kePrint())
+ bs <- getOption("kableExtra.html.bsTable", default = FALSE)
+ if (bs) {
+ meta_list[[2]] <- html_dependency_bsTable()
+ }
+ asis_output(x, meta = meta_list)
}
diff --git a/R/zzz.R b/R/zzz.R
index 982d9de..fcdac4b 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -18,4 +18,10 @@
}
auto_format <- getOption("kableExtra.auto_format", default = TRUE)
if (auto_format) auto_set_format()
+ if (!is.null(rmarkdown::metadata$output) &&
+ rmarkdown::metadata$output %in% c(
+ "ioslides_presentation", "slidy_presentation"
+ )) {
+ options(kableExtra.html.bsTable = TRUE)
+ }
}