[R] [Rmarkdown] html_document - custom CSS for code snippets
Duncan Murdoch
murdoch.duncan at gmail.com
Fri Aug 21 17:29:13 CEST 2015
On 21/08/2015 9:38 AM, Omar André Gonzáles Díaz wrote:
> Hi Community,
>
> I'm using custom CSS to modify my html_document, genereted using knirt.
>
> According to this page:
>
> http://rmarkdown.rstudio.com/html_document_format.html
>
> I have to turn off: 1) theme: null and 2) highlight: null. And use:
> 3) css: my_styles.css (my css document).
>
> I've achieved to use some html tags, like <main></main> to give some
> left margin to the document. But i cannot apply correctly html tags to
> the code snipets, and convert it's background to gray.
>
> So my code snipets show the code, but the background is white, and has
> no difference with the white background of the page.
>
> What can i do?
>
> *Extra: Now i'm displaying some R code, but i would like to display
> also some javascript code. Is this possible?
Sure, just enter it as
```
x = 1;
for (var i=0; i<2; i++)
```
You won't get syntax highlighting; if you want that, you'll need to
create a "Javascript engine"; see ?knitr::knit_engines, or use a
different one (the "coffee" engine is probably fine):
```{coffee, eval=FALSE}
x = 1;
for (var i=0; i<2; i++)
```
Duncan Murdoch
More information about the R-help
mailing list