【问题标题】:How do I edit bootstrap theme in rmarkdown?如何在 rmarkdown 中编辑引导主题?
【发布时间】:2017-10-26 14:13:01
【问题描述】:

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

【问题讨论】:

  • 您可以添加自己的custom css file。这不适合您的情况吗?
  • 我确实有一个正在使用的 style.css,但我不够熟练,无法添加代码行来更改导航菜单的颜色。
  • 所以这只是一个关于 CSS 而不是 R 的问题吗?听起来您需要 CSS/Bootstrap 帮助,但这不是您标记问题的方式。
  • 谢谢。只是想学习。

标签: css r rstudio r-markdown


【解决方案1】:

如果你真的想改变 cosmos 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)
```

【讨论】:

  • 谢谢。我找到了该文件,但似乎每当我 构建网站 时,编辑后的 ​​cosmo.min.css 文件都会通过恢复到其原始脚本来恢复自身。
  • 我无法重新创建此问题,更改 cosmo.min.css 没有问题。当我编织我的 rmd 时,它工作得很好。
  • 嗯..多么奇怪的现象。无论我是编写单个 rmd 还是构建整个网站,我的 cosmo.min.css 都会恢复到其原始脚本。无论如何,谢谢,现在我知道了我必须处理的确切参数,这对我来说是一大步。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多