From ac6236f965c0805cd4b56502da3240f83d6f25b8 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Tue, 19 Nov 2024 00:36:23 +0100 Subject: [PATCH] Add support for litedown --- R/articles.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/R/articles.R b/R/articles.R index 50c0c73..6bd9d63 100644 --- a/R/articles.R +++ b/R/articles.R @@ -110,6 +110,17 @@ replace_rmarkdown_engine <- function(){ quarto_engine <- tools::vignetteEngine('html', package='quarto') environment(quarto_engine$weave)$meta$format$html <- quarto_html_meta() }) + + # Use knitr for of litedown (not sure if they use compatible Rmarkdown?) + setHook(packageEvent("litedown", "onLoad"), function(...) { + message("Found litedown! Replacing html engine...") + tools::vignetteEngine('vignette', package = 'litedown', tangle = rmd_engine$tangle, + pattern = rmd_engine$pattern, weave = function(file,..., output_format = NULL){ + load_custom_output_package(file) + rmd_engine$weave(file,..., output_format = r_universe_format()) + } + ) + }) } # If a package uses a custom 'output' it may also assume functions from this package