使用 quarto 的 Reveal 实现在标题幻灯片中自定义背景

cca*_*ara 7 pandoc reveal.js quarto

我正在使用 quarto 的 Reveal.js 实现。我一直在阅读有关自定义主题的官方文档页面,并且对 SCSS 规则相对熟悉。

我已经能够为幻灯片创建类,然后通过 SCSS 规则自定义它们。遗憾的是,我无法向#title-slide覆盖整个区域的第一张幻灯片 ( ) 添加自定义背景(颜色或理想情况下图像背景),就像我在其他常规幻灯片中所做的那样,如此处所述

除了将演示文稿的属性留空之外,还有什么方法可以将自定义背景添加到第一张幻灯片吗?

编辑:

不确定这是否是正确的方法,但我尝试在 yaml 元数据中添加背景图像 url 并且它有效:


---
title: "My title"
background-image: "https://images.unsplash.com/flagged/photo-1580139624070-910f651c1b78?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
background-opacity: "0.45"
format: 
  revealjs:
    theme: [default]
    logo: images/logo_black.png
editor: visual
---
Run Code Online (Sandbox Code Playgroud)

遗憾的是,诸如background-color和 之类的属性background-opacity不起作用。

cca*_*ara 12

仅供记录,在@tarleb 的评论将我指向pandoc 的文档之后,我通过在 yaml 的元数据上添加以下内容来使其工作:

---
[...]
title-slide-attributes:
    data-background-image: "/path/to/image"
    data-background-size: contain
    data-background-opacity: "number"
[...]
---
Run Code Online (Sandbox Code Playgroud)

可以看到,其他属性也可以传递,只要

  1. 它们缩进在下面title-slide-attributes
  2. 它们前面带有data-

  • PS:添加了包含此信息的 PR,以便可以将其添加到 quarto 的官方文档中:https://github.com/quarto-dev/quarto-web/pull/251 (2认同)