Skip to content

Commit

Permalink
Merge pull request #61 from fmichonneau/fix-rmd-formatting
Browse files Browse the repository at this point in the history
Fix Rmd formatting
  • Loading branch information
Greg Wilson authored and GitHub committed Jun 22, 2016
2 parents ea2a2ee + ff37db0 commit 1044395
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/chunk-options.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@ opts_chunk$set(tidy = FALSE, results = "markup", comment = NA,
# The hooks below add html tags to the code chunks and their output so that they
# are properly formatted when the site is built.
hook_in <- function(x, options) {
stringr::str_c("\n\n~~~{.r}\n",
stringr::str_c("\n\n~~~\n",
paste0(x, collapse="\n"),
"\n~~~\n{: .source}\n\n")
"\n~~~\n{: .r}\n\n")
}

hook_out <- function(x, options) {
x <- gsub("\n$", "", x)
stringr::str_c("\n\n~~~\n",
paste0(x, collapse="\n"),
"\n~~~\n{: .output}\n\n")
}

hook_error <- function(x, options) {
x <- gsub("\n$", "", x)
stringr::str_c("\n\n~~~\n",
paste0(x, collapse="\n"),
"\n~~~\n{: .error}\n\n")
Expand Down

0 comments on commit 1044395

Please sign in to comment.