Customise output of R code using a knitr output hook
Closed this issue · 3 comments
cderv commented
About output hook, some example could be part of the cookbook
- Customise
error
output to change color of error message in html (SO QA)
knitr::knit_hooks$set(error = function(x, options) {
paste0("<pre style=\"color: red;\"><code>", x, "</code></pre>")
})
cderv commented
About the example above, this is now way easier with the new class.*
options
```{css, echo = FALSE}
.rerror {
color: red;
}
```
```{r error=TRUE, class.error="rerror"}
stop("test")
```