pat shipan
pat shipan

Reputation: 763

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?

Upvotes: 5

Views: 744

Answers (1)

Droplet
Droplet

Reputation: 1135

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>

Upvotes: 1

Related Questions