在 R Markdown 演示文稿中覆盖 Reveal.js

Err*_*ard 5 css r rstudio r-markdown reveal.js

我试图在 rmarkdown 中整合一个 Reveal-js 演示文稿,但在覆盖默认 css 主题时遇到问题。我想从我的绘图图像中删除边框。根据文档,这应该有效:

自定义CSS

但事实并非如此,我猜这是因为这个覆盖并不更具体。但我的问题是我通常提高特异性的方法也不起作用:

## Slide with Plot
<section class = "no-border">
```{r pressure}
plot(pressure)
```
</section>
Run Code Online (Sandbox Code Playgroud)

这是 YAML 标头:

title: "Title"
author: "..."
date: '`r paste(format(Sys.Date(),"%d")," ", mymonths[sys.man], ", ",
                format(Sys.Date(),"%Y"), sep = "")`'
output:
  revealjs::revealjs_presentation:
    incremental: true
    includes:
      in_header: slidy_bootstrap_header.html
      css: slidyStandard.css
Run Code Online (Sandbox Code Playgroud)

这是 css 覆盖:

section.no-border > img {
  background:none; 
  border:none; 
  box-shadow:none;
 }
Run Code Online (Sandbox Code Playgroud)

有人知道我做错了什么吗?

Err*_*ard 3

我意识到我将 custom-css 放在了 YAML 标头中的错误位置。因此,它不起作用。

下面是使用自定义 css 的可重现代码:

---
title: "Untitled"
output: 
  revealjs::revealjs_presentation:
    css: custom2.css
---

## R Markdown

This is an R Markdown presentation. 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.

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Code and Output

```{r}
summary(cars)
```

## Slide with Plot

```{r, echo=FALSE}
plot(cars)
```
Run Code Online (Sandbox Code Playgroud)

和CSS:

.reveal section img {
  margin: 15px 0px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  box-shadow: none; 
  }
Run Code Online (Sandbox Code Playgroud)