al-obrien
al-obrien

Reputation: 1423

inf_mr does not refresh with xaringan slides

When I save xaringan slides with --- at the very beginning of the presentation, they must be removed before xaringan::inf_mr() will refresh the viewer panel and update changes. The following example should help create the situation:

(1) Create .Rmd file...

---
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) Now I run Rmd file with xaringan::inf_mr()... When I do this the viewer will not refresh unless I now comment/remove, without saving, the ---:

---
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

Now the viewer will refresh. However, every time I have to save the Rmd file, if I want the viewer to work I have to un-comment/re-comment this ---. I must be missing something quite basic but I do not believe anyone else has reported this problem.

Here are some additional details about my system:

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’

My xaringan version is 0.8.15.

If more clarity is needed just let me know.

Thank you!

EDIT

I added the following code to the .Rmd documents (as based on this wiki), this should better illustrate the issue being faced:

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

Upvotes: 2

Views: 541

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30184

xaringan::inf_mr() had a bug that prevented it from counting the number of slides correctly (not taking layout: true into consideration). I have fixed it on Github, and you can install the development version via:

remotes::install_github('yihui/xaringan')

Upvotes: 1

Related Questions