X-Git-Url: https://git.arvados.org/rnaseq-cwl-training.git/blobdiff_plain/40dbc703e9fcc162aca3244c92a552acc4805db4..9259abf17b39c66f5e0912d127f5e4e5f63b8c57:/bin/chunk-options.R?ds=sidebyside diff --git a/bin/chunk-options.R b/bin/chunk-options.R index 5836973..f943584 100644 --- a/bin/chunk-options.R +++ b/bin/chunk-options.R @@ -8,6 +8,18 @@ library("knitr") fix_fig_path <- function(pth) file.path("..", pth) + +## We set the path for the figures globally below, so if we want to +## customize it for individual episodes, we can append a prefix to the +## global path. For instance, if we call knitr_fig_path("01-") in the +## first episode of the lesson, it will generate the figures in +## `fig/rmd-01-` +knitr_fig_path <- function(prefix) { + new_path <- paste0(opts_chunk$get("fig.path"), + prefix) + opts_chunk$set(fig.path = new_path) +} + ## We use the rmd- prefix for the figures generated by the lssons so ## they can be easily identified and deleted by `make clean-rmd`. The ## working directory when the lessons are generated is the root so the @@ -25,7 +37,7 @@ opts_chunk$set(tidy = FALSE, results = "markup", comment = NA, hook_in <- function(x, options) { stringr::str_c("\n\n~~~\n", paste0(x, collapse="\n"), - "\n~~~\n{: .r}\n\n") + "\n~~~\n{: .language-r}\n\n") } hook_out <- function(x, options) {