Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use highlight.js theme in rmarkdown::html_document() .Rmd

Can I specify a highlight.js style in RMarkdown front matter when using html_document?

example:

Instead of using pandoc's espresso highlighting say I want highlight.js's tommorrow highlithing which lives here

---
title: "Untitled"
output: 
  html_document:
    highlight: espresso
---

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r}
summary(cars)
```

etc...

How might I do this?

like image 718
pat shipan Avatar asked Nov 09 '22 13:11

pat shipan


1 Answers

As far as I know, there is not built-in way to do this but you can add the following lines at the beginning of your Rmd document to get what you want:

<style type="text/css">
@import "https://highlightjs.org/static/demo/styles/tomorrow.css";
</style>
like image 77
Droplet Avatar answered Nov 15 '22 07:11

Droplet