# NOT RUN {
if (rmarkdown::pandoc_available("1.12.3")) {
path = system.file("extdata", "example.Rmd", package = "ariExtra")
tfile = tempfile(fileext = ".pdf")
out = try({
output_file = tempfile(fileext = ".html")
rmarkdown::render(path, output_file = output_file)
pagedown::chrome_print(output_file,
output = tfile)
}, silent = TRUE)
if (!inherits(out, "try-error")) {
res = rmd_to_ari(path, open = FALSE)
res$output_file
}
}
# }
# NOT RUN {
# }
# NOT RUN {
# xaringan example
if (requireNamespace("xaringan", quietly = TRUE)) {
path = system.file("examples", "lucy-demo.Rmd", package = "xaringan")
# get rid of ggplot2 dependency
x = readLines(path)
x = gsub("library\\(ggplot2\\)", "", x)
x = gsub("^\\s*ggplot.*", "", x)
x = gsub("^\\s*geom_bar.*", "barplot(table(mtcars$am))", x)
path = tempfile(fileext = ".Rmd")
writeLines(x, path)
rendered_file = tempfile(fileext = ".html")
required_pandoc <- "1.12.3"
have_pandoc_version = rmarkdown::pandoc_available(required_pandoc)
if (have_pandoc_version) {
rmarkdown::render(path,
output_format = xaringan::moon_reader(),
output_file = rendered_file)
} else {
rendered_file = system.file("extdata",
"lucy-demo-noggplot2.html",
package = "ariExtra")
}
script = c("this", "is", "one", "word", "per slide")
have_decktape = nzchar(Sys.which("decktape"))
if (have_decktape) {
pdf_file = tempfile(fileext = ".pdf")
xaringan::decktape(rendered_file, pdf_file, docker = FALSE)
res = pdf_to_ari(pdf_file, script = script, open = FALSE)
result = rmd_to_ari(path = path,
script = script,
rendered_file = rendered_file,
capturer = "decktape")
}
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab