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

标签 r rstudio r-markdown pandoc

我可以指定一个 highlight.js使用 html_document 时 RMarkdown 前端的样式?

例子:

而不是使用 pandocespresso突出显示说我想要 highlight.jstommorrow活着的highlithing 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...

我该怎么做?

最佳答案

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

<style type="text/css">
@import "https://highlightjs.org/static/demo/styles/tomorrow.css";
</style>

关于r - 在 rmarkdown::html_document() .Rmd 中使用 highlight.js 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30145208/

相关文章:

r - 如何cbind R中矩阵列表的所有行组合

rmarkdown 从 RStudio 内部运行子 block

r - shinydasboard 未加载 R

r - kable/kableExtra 在 group_rows 中为组标签添加上标

R Markdown 无法编织

r - 将变量传递给 tidyr 的集合以重命名键/值列?

r - R中的大型混合整数规划 - 可以解决吗?

c++ - 通过 Rcpp 调用 boost::threadpool 时 RStudio 挂起

r - 使用 knit/rmarkdown 突出显示 bash 代码

r - 使用 data.table 在单个条件下替换多列