Including commented out R code in Xaringan possibly causes rendering problems for subsequent slides

Today I've noticed an issue where commented out R code within a Xaringan slide seems to stop the slides that follow it from rendering.

I don't think that it's a code problem because I'm just running code that was fine on Monday. So possibly there has been a package update between Monday and now that is causing the issue? (I don't think that it's the Xaringan package itself, because I tried reverting to version 0.12 and the issue is still there. I have also tried reverting rlang to 0.4.2, again the issue is still there.)

This may be similar to this issue from 2017:

I am able to reproduce the issue by creating a new Xaringan presentation by opening R Studio, then:
File -> New File -> R Markdown -> From Template -> (scroll down to) Ninja Presentation -> OK.

(As an aside, in order to render the default I have to delete with the default code in lines 208 to 212, but that's nothing to do with this issue.)

Then comment the R code in lines 44 to 46 by selecting lines 43 to 46 and Command + Shift + m.

Those lines should now look like this:

<!-- ```{r eval=FALSE, tidy=FALSE} -->
<!-- devtools::install_github("yihui/xaringan") -->
<!-- ``` -->

Then knit the document. When I do this "You are recommended to use..." is no longer on a different slide, etc, even though the slide break has not been commented, and many slides are no longer showing up (my guess is that they are all on that slide 5).

Does anyone have any thoughts on what might be causing this?

One work-around is to just delete everything that is commented! All the slides then render properly, but that's not an ideal solution.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.