Skip to content

Commit

Permalink
Try again setting litedown vignette engine
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Dec 26, 2024
1 parent bf39c74 commit 42b6955
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions R/articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ replace_rmarkdown_engine <- function(){
}, tangle = old_engine$tangle, pattern = old_engine$pattern)
})

# Litedown (TODO: do not override slides)
setHook(packageEvent("litedown", "onLoad"), function(...) {
message("Found litedown! Replacing vignette theme...")
old_engine <- tools::vignetteEngine('vignette', package='litedown')
tools::vignetteEngine('litedown', package = 'litedown', weave = function(file, ...){
mdfile <- file.path(tempdir(), paste0(tools::file_path_sans_ext(file), '.md'))
load_custom_output_package(file)
litedown::fuse(file, mdfile, ...)
htmlfile <- render_article(mdfile)
file.copy(htmlfile, '.', overwrite = TRUE)
}, tangle = old_engine$tangle, pattern = old_engine$pattern)
})

# Experimental quarto override
setHook(packageEvent("quarto", "onLoad"), function(...) {
message("Found quarto! Replacing html engine...")
Expand Down

0 comments on commit 42b6955

Please sign in to comment.