1 generate_md_episodes <- function() {
3 if (require("knitr")) {
4 if (packageVersion("knitr") < '1.9.19') {
5 stop("knitr must be version 1.9.20 or higher")
7 } else stop("knitr 1.9.20 or above is needed to build the lessons.")
9 if (!require("stringr"))
10 stop("The package stringr is required for generating the lessons.")
12 ## find all the Rmd files, and generates the paths for their respective outputs
13 src_rmd <- list.files(pattern = "??-*.Rmd$", path = "_episodes_rmd", full.names = TRUE)
14 dest_md <- file.path("_episodes", gsub("Rmd$", "md", basename(src_rmd)))
16 ## knit the Rmd into markdown
17 mapply(function(x, y) {
18 knitr::knit(x, output = y)
23 generate_md_episodes()