// code boxes
$color-error: #bd2c00 !default;
+$color-warning: #cda01d !default;
$color-output: #303030 !default;
$color-source: #360084 !default;
border-radius: 4px 0 0 4px;
}
-.error { @include cdSetup($color-error); }
-.output { @include cdSetup($color-output); }
-.source { @include cdSetup($color-source); }
+.error { @include cdSetup($color-error); }
+.warning { @include cdSetup($color-warning); }
+.output { @include cdSetup($color-output); }
+.source { @include cdSetup($color-source); }
.bash, .language-bash { @include cdSetup($color-source); }
.make, .language-make { @include cdSetup($color-source); }
.sql, .language-sql { @include cdSetup($color-source); }
.error::before,
+.warning:before,
.output::before,
.source::before,
.bash::before, .language-bash::before,
.python::before, .language-python::before,
.r::before, .language-r::before,
.sql::before, .language-sql::before {
- background-color: #f2eff6;
- display: block;
- font-weight: bold;
- padding: 5px 10px;
+ background-color: #f2eff6;
+ display: block;
+ font-weight: bold;
+ padding: 5px 10px;
}
.error::before { background-color: #ffebe6; content: "Error"; }
+.warning:before { background-color: #f8f4e8; content:" Warning"; }
.output::before { background-color: #efefef; content: "Output"; }
.source::before { content: "Code"; }
.bash::before, .language-bash::before { content: "Bash"; }
hook_out <- function(x, options) {
x <- gsub("\n$", "", x)
stringr::str_c("\n\n~~~\n",
- paste0(x, collapse="\n"),
- "\n~~~\n{: .output}\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")
+ paste0(x, collapse="\n"),
+ "\n~~~\n{: .error}\n\n")
+}
+
+hook_warning <- function(x, options) {
+ x <- gsub("\n$", "", x)
+ stringr::str_c("\n\n~~~\n",
+ paste0(x, collapse = "\n"),
+ "\n~~~\n{: .warning}\n\n")
}
-knit_hooks$set(source = hook_in, output = hook_out, warning = hook_error,
- error = hook_error, message = hook_out)
+knit_hooks$set(source = hook_in, output = hook_out, warning = hook_warning,
+ error = hook_error, message = hook_out)