在 rmarkdown::html_document() .Rmd 中使用 highlight.js 主题

pat*_*pan 5 r pandoc rstudio r-markdown

highlight.js使用 html_document 时,我可以在 RMarkdown 前端指定样式吗?

例子:

而不是使用pandoc's espressohighlighting 说我想要highlight.js's tommorrowhighlithing 它住在这里

---
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...
Run Code Online (Sandbox Code Playgroud)

我该怎么做?

Dro*_*let 1

据我所知,没有内置的方法可以做到这一点,但您可以在文档的开头添加以下几行Rmd来获得您想要的内容:

<style type="text/css">
@import "https://highlightjs.org/static/demo/styles/tomorrow.css";
</style>
Run Code Online (Sandbox Code Playgroud)