inf_mr 不刷新 xaringan 幻灯片

inf_mr does not refresh with xaringan slides

当我在演示开始时用 --- 保存 xaringan 幻灯片时,必须先删除它们,然后 xaringan::inf_mr() 才会刷新查看器面板并更新更改。下面的例子应该有助于创造这种情况:

(1) 创建 .Rmd 文件...

---
title: "Presentation Ninja"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
     highlightStyle: github
     highlightLines: true
     countIncrementalSlides: false
---
layout: true
background-image: url(https://github.com/yihui/xaringan/releases/download/v0.0.2/karl-moustache.jpg)
background-position: 91% 94%
background-size: 185px

<!-- Must have this break below -->
---

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```

# Test slide
Testing

---

# Test slide 2
Testing

---

# Test slide 3
Testing

(2) 现在我 运行 Rmd 文件 xaringan::inf_mr()... 当我这样做时,查看器不会刷新,除非我现在 comment/remove,不保存, ---:

---
title: "Presentation Ninja"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
     highlightStyle: github
     highlightLines: true
     countIncrementalSlides: false
---
layout: true
background-image: url(https://github.com/yihui/xaringan/releases/download/v0.0.2/karl-moustache.jpg)
background-position: 91% 94%
background-size: 185px
<!-- Commented Out Now -->
<!-- --- -->

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```

# Test slide
Testing

---

# Test slide 2
Testing

---

# Test slide 3
Testing

现在查看器将刷新。但是,每次我必须保存 Rmd 文件时,如果我想让查看器工作,我必须 un-comment/re-comment 这个 ---。我一定是遗漏了一些非常基本的东西,但我相信没有其他人报告过这个问题。

以下是有关我的系统的一些其他详细信息:

R.Version()
$`platform`
[1] "x86_64-w64-mingw32"

$arch
[1] "x86_64"

$os
[1] "mingw32"

$system
[1] "x86_64, mingw32"

$language
[1] "R"

$version.string
[1] "R version 3.5.1 (2018-07-02)"

$nickname
[1] "Feather Spray"

-

rstudioapi::versionInfo()
$`mode`
[1] "desktop"

$version
[1] ‘1.2.1237’

我的 xaringan 版本是 0.8.15.

如果需要更清楚的说明,请告诉我。

谢谢!

编辑

我在 .Rmd 文档中添加了以下代码(基于 this wiki),这应该能更好地说明所面临的问题:

layout: true
background-image: url(https://github.com/yihui/xaringan/releases/download/v0.0.2/karl-moustache.jpg)
background-position: 91% 94%
background-size: 185px

xaringan::inf_mr()a bug that prevented it from counting the number of slides correctly (not taking layout: true into consideration). I have fixed it on Github,您可以通过以下方式安装开发版:

remotes::install_github('yihui/xaringan')