From 04473a4530e540dfdf96be0f768c0568714ff3d3 Mon Sep 17 00:00:00 2001 From: Duncan Garmonsway Date: Wed, 2 Oct 2019 13:22:35 +0100 Subject: [PATCH] Override argument passed by rmarkdown::render_site `rmarkdown::render_site()` passes `self_contained = TRUE` into the ellipsis (dots) `...` argument of `govdown_document()`, which passes it on to where it causes rendering of large images to hang. Reported in #39, introduced when fixing #32. --- R/govdown-format.R | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/R/govdown-format.R b/R/govdown-format.R index 999d925..947fde5 100644 --- a/R/govdown-format.R +++ b/R/govdown-format.R @@ -192,17 +192,10 @@ govdown_document <- function(keep_md = FALSE, # Use highlights.js from the rmarkdown package extra_dependencies <- list(rmarkdown::html_dependency_highlightjs("default")) - base_format <- rmarkdown::output_format( - knitr = NULL, - pandoc = rmarkdown::pandoc_options( - to = "html", - from = rmarkdown::from_rmarkdown(implicit_figures = FALSE, - extensions = "+smart") - ), - keep_md = keep_md, - pre_processor = pre_processor, - base_format = - rmarkdown::html_document_base( + dots <- list(...) + html_document_base_args <- + c( + list( mathjax = NULL, pandoc_args = c(pandoc_args, "--css", rmarkdown::pandoc_path_arg(css), @@ -214,9 +207,24 @@ govdown_document <- function(keep_md = FALSE, "--highlight-style=pygments", "--mathjax" ), - extra_dependencies = extra_dependencies, - ... - ) + extra_dependencies = extra_dependencies + ), + dots) + + # override arguments provided by rmarkdown::render_site() + html_document_base_args$self_contained <- NULL + + base_format <- rmarkdown::output_format( + knitr = NULL, + pandoc = rmarkdown::pandoc_options( + to = "html", + from = rmarkdown::from_rmarkdown(implicit_figures = FALSE, + extensions = "+smart") + ), + keep_md = keep_md, + pre_processor = pre_processor, + base_format = do.call(rmarkdown::html_document_base, + html_document_base_args) ) base_format