Description Usage Arguments Value Examples
Convert a Rmd to an Ari Document
1 2 3 4 5 6 7 8 9 10 |
path |
path to Rmd file |
script |
optional spoken script, otherwise taken from the HTML comments |
capture_method |
Either |
capturer |
Methods for capturing the HTML slides |
capturer_args |
a list of arguments to pass to webshot::webshot or pagedown::chrome_print |
... |
additional arguments to pass to make_ari_document |
rendered_file |
the HTML output already from render |
verbose |
print diagnostic messages |
The output of make_ari_document
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 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
}
}
# 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")
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.