|
|
|
@@ -29,6 +29,7 @@ |
|
|
|
#' --- |
|
|
|
#' ``` |
|
|
|
#' |
|
|
|
#' @inheritParams rmarkdown::html_document_base |
|
|
|
#' @inheritDotParams rmarkdown::html_document_base |
|
|
|
#' @export |
|
|
|
bulma_document <- function( |
|
|
|
@@ -41,6 +42,7 @@ bulma_document <- function( |
|
|
|
dev = "png", |
|
|
|
toc = FALSE, |
|
|
|
toc_depth = 3, |
|
|
|
mathjax = "default", |
|
|
|
pandoc_args = NULL, |
|
|
|
extra_dependencies = NULL |
|
|
|
) { |
|
|
|
@@ -93,6 +95,25 @@ bulma_document <- function( |
|
|
|
|
|
|
|
pandoc_args <- c(pandoc_args, rmarkdown::pandoc_toc_args(toc, toc_depth)) |
|
|
|
|
|
|
|
mathjax_url <- if (mathjax %in% c("default", "local")) { |
|
|
|
mathjax_local <- Sys.getenv("RMARKDOWN_MATHJAX_PATH", unset = NA) |
|
|
|
if (mathjax == "local" && is.na(mathjax_local)) { |
|
|
|
rlang::warn( |
|
|
|
glue("Please use `Sys.setenv('RMARKDOWN_MATHJAX_PATH')` to set local mathjax location.", |
|
|
|
"Falling back to online mathjax from https://mathjax.rstudio.com") |
|
|
|
) |
|
|
|
} |
|
|
|
mathjax_path <- ifelse(mathjax == "default" || is.na(mathjax_local), |
|
|
|
"https://mathjax.rstudio.com/latest", |
|
|
|
mathjax_local) |
|
|
|
file.path(mathjax_path, "MathJax.js?config=TeX-AMS-MML_HTMLorMML") |
|
|
|
} else mathjax |
|
|
|
|
|
|
|
if (!is.null(mathjax_url)) { |
|
|
|
pandoc_args <- c(pandoc_args, "--mathjax", "--variable", |
|
|
|
paste0("mathjax-url:", mathjax_url)) |
|
|
|
} |
|
|
|
|
|
|
|
rmarkdown::output_format( |
|
|
|
knitr = rmarkdown::knitr_options_html( |
|
|
|
fig_width, fig_height, fig_retina, keep_md, dev |
|
|
|
@@ -112,6 +133,7 @@ bulma_document <- function( |
|
|
|
base_format = rmarkdown::html_document_base( |
|
|
|
self_contained = TRUE, template = NULL, |
|
|
|
pandoc_args = pandoc_args, |
|
|
|
mathjax = mathjax, |
|
|
|
extra_dependencies = extra_dependencies |
|
|
|
) |
|
|
|
) |