Skip to content

Commit 6d015fe

Browse files
committed
specify language based on engine
- fix swcarpentry/r-novice-inflammation#436
1 parent 9320702 commit 6d015fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bin/chunk-options.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ opts_chunk$set(tidy = FALSE, results = "markup", comment = NA,
3737
# are properly formatted when the site is built.
3838

3939
hook_in <- function(x, options) {
40+
lg <- tolower(options$engine)
41+
style <- paste0(".language-", lg)
42+
4043
stringr::str_c("\n\n~~~\n",
41-
paste0(x, collapse="\n"),
42-
"\n~~~\n{: .language-r}\n\n")
44+
paste0(x, collapse="\n"),
45+
"\n~~~\n{: ", style, "}\n\n")
4346
}
4447

4548
hook_out <- function(x, options) {

0 commit comments

Comments
 (0)