Skip to content

Commit

Permalink
specify language based on engine
Browse files Browse the repository at this point in the history
  • Loading branch information
fmichonneau committed Jun 21, 2019
1 parent 9320702 commit 6d015fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bin/chunk-options.R
Expand Up @@ -37,9 +37,12 @@ opts_chunk$set(tidy = FALSE, results = "markup", comment = NA,
# are properly formatted when the site is built.

hook_in <- function(x, options) {
lg <- tolower(options$engine)
style <- paste0(".language-", lg)

stringr::str_c("\n\n~~~\n",
paste0(x, collapse="\n"),
"\n~~~\n{: .language-r}\n\n")
paste0(x, collapse="\n"),
"\n~~~\n{: ", style, "}\n\n")
}

hook_out <- function(x, options) {
Expand Down

0 comments on commit 6d015fe

Please sign in to comment.