Description Usage Value Examples
This will set the document options, chunk options, and hooks to comply with
1 | dvt_opts()
|
a file path
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 | # Make sure we reset the original options when we exit this.
ok <- knitr::opts_knit$get()
oc <- knitr::opts_chunk$get()
oh <- knitr::knit_hooks$get()
on.exit({
knitr::opts_knit$set(ok)
knitr::opts_chunk$set(oc)
knitr::knit_hooks$set(oh)
})
if (requireNamespace("withr", quietly = TRUE)) {
withr::with_dir(system.file("extdata", package = "dovetail"), {
source(dvt_opts())
# The default error is just to print
cat(oh$error(c("this is a dramatic...", "", "error")))
jekerr <- knitr::knit_hooks$get("error")
# The dovetail error is formulated for jekyll with a kramdown tag
cat(jekerr(c("this is a dramatic...", "", "error")))
# The output directory has been updated to the top of the project. This is
# To account for the fact that Jekyll sites store their assets in the top
# level directory
ok$base.dir
knitr::opts_knit$get("base.dir")
# The figure paths have been updated
oc$fig.path
knitr::opts_chunk$get("fig.path")
# Use a loaded function to update this:
knitr_fig_path(prefix = "01-")
knitr::opts_chunk$get("fig.path")
})
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.