在Rmarkdown中从YAML调整Reveal.initialize

时间:2018-11-20 09:42:48

标签: r-markdown reveal.js

我在Rmarkdown中使用此YAML标头制作了一个showjs演示文稿:

---
title: "My title"
author: "My name"
date: November 20, 2018
output: 
  revealjs::revealjs_presentation:
      css: styles.css
---

它工作正常,但现在我想在width中调整Reveal.initialize。现在,我正在生成Rmarkdown的html中直接在文件的结尾处直接进行此操作:

// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
    width: 1000,
    // Push each slide change to the browser history
    history: true,
    // Vertical centering of slides
    center: false,
    // Transition style
    transition: 'default', // none/fade/slide/convex/concave/zoom
    // Transition style for full page slide backgrounds
    backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom

我希望能够从Rmarkdown的YAML中做到这一点。我已经尝试过这种方法,但是不起作用:

---
title: "My title"
author: "My name"
date: November 20, 2018
output: 
  revealjs::revealjs_presentation:
      css: styles.css
  revealjs::revealjs_config:
      width: 1200
---

有什么主意吗?

1 个答案:

答案 0 :(得分:1)

最后,我找到了正确的方法:

---
output: 
  revealjs::revealjs_presentation:
    css: styles.css
    reveal_options:
      width: 1200
---