如何在 rmarkdown 中编辑 bootstrap 主题?

How do I edit bootstrap theme in rmarkdown?

我目前在 rmarkdown 中使用 cosmo 主题。如果我想更改导航菜单的颜色,或者更具体地说,更改菜单高亮显示,我应该编辑哪个文件?

如果你真的想改变宇宙CSS你可以在这里找到它:[path to libraries]/rmarkdown/rmd/h/bootstrap-3.3.5/css/cosmo.min.css但是如果我只需要改变一件事,我通常只把CSS放到markdown 文档,如下例所示。

您也可以附上您自己的 CSS,如此处记录:http://rmarkdown.rstudio.com/html_document_format.html#custom_css

---
title: "Untitled"
author: "Ian Wesley"
date: "May 25, 2017"
output: 
  html_document:
    theme: cosmo

---

<style>
  h2{
    font-size: 50px !important;
    color: crimson !important
  }
</style>

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

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 cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```