Commit 10443956 authored by Greg Wilson's avatar Greg Wilson Committed by GitHub
Browse files

Merge pull request #61 from fmichonneau/fix-rmd-formatting

Fix Rmd formatting
parents ea2a2eec ff37db08
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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")