Last active
February 26, 2020 19:00
-
-
Save gadenbuie/a88cc315130d2ef564dc229576084cdf to your computer and use it in GitHub Desktop.
styled code output in xaringan slides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
output: | |
xaringan::moon_reader: | |
lib_dir: libs | |
chakra: "https://cdnjs.cloudflare.com/ajax/libs/remark/0.14.0/remark.min.js" | |
seal: false | |
nature: | |
slideNumberFormat: "" | |
highlightStyle: github | |
ratio: "16:9" | |
--- | |
.bg-danger[ | |
```{r, error=TRUE} | |
stop("Danger, Will Robinson") | |
``` | |
] | |
```{css echo=FALSE} | |
.bg-danger pre + pre { | |
color: red; | |
background-color: #FEE; | |
padding: 1em; | |
border-radius: 5px; | |
} | |
``` |
Author
gadenbuie
commented
Feb 24, 2020
Ah okay, thats what I thought you meant. Seems like the downside of this is how manual it is, and also you would need to know ahead of time what code will produce an output, message, warning, or error. And I guess you can only apply one CSS style to any of the above outputs produced by a single piece of code (versus different styles per type of output), right?
Unfortunately there's not really any way around this other than re-writing the kntir
r
chunk engine specifically for xaringan
(not a recommended solution).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment