Carmen Sandoval
Carmen Sandoval

Reputation: 2356

How to set knitr syntax highlighting themes in R Notebooks?

I'm trying to get one of the knitr highlight themes applied to my R Notebook, but what I'm doing doesn't work (in both the Notebook Preview and the Knitted HTML file.)

Can you explain to me what the proper way to do this is?

Thanks!

  ---
    output:
      html_notebook: 
        code_folding: none
        df_print: kable
        theme: yeti
        toc: yes
        toc_depth: 4
      html_document:
        df_print: kable
    ---


        ```{r}
        library(knitr)
        thm = knit_theme$get("molokai")  # parse the theme to a list
        knit_theme$set(thm)
        ```

Message when running command in R Notebook. Message when running command in R Notebook.

What the knitted html loks like. enter image description here

Upvotes: 0

Views: 820

Answers (0)

Related Questions