I want to write a demo with xaringan for xaringan. I want to write a slide where I explain how students can write inline code or code chunks, but so far my attempts failed. Mostly because the `
are not printed. If i use `r knitr::inline_expr('mean(mtcars$mpg)')`
the `
are not printed.
Actually, it should work as mentioned in the comment, but it doesn't for some reason. This may be a bug. However, you can simply write a CSS class that highlights monospaced text and adds backticks before and after your code.
Add the following to the styles.css file in your xaringan project directory:
.ilr {
font-family: monospace;
padding: 2px 2px;
background-color: #e4e6e8;
}
.ilr:before, .ilr:after {
content: "`";
}
Use the above as follows:
---
# Test Slide
This is inline code: .ilr[r rnorm(100)].