7.4 Build and preview slides
You can knit the source document like other Rmd documents to view the output, but it may be tedious to have to knit it over and over again whenever you make changes. The other way to preview the slides is the RStudio addin “Infinite Moon Reader” or the function
xaringan::inf_mr(), as mentioned in Section 2.2. With this way, you can continuously preview your slides just by saving the source document. The continuous preview is achieved via a local web server launched by the servr package (Xie 2021c).
One distinction of
output: xaringan::moon_reader: self_contained: true
!(PATH) (Markdown syntax),
<img src="PATH" /> (HTML syntax), and
background-image: url(PATH) (remark.js syntax for background images). Other types of images will not be discovered or embedded.
If you have to publish the slides to a web server, but xaringan’s self-contained mode fails to identify certain resources and embed them, please feel free to file an issue to the GitHub repository at https://github.com/yihui/xaringan. If you publish slides to GitHub Pages or Netlify, this may not be a problem, because you can commit or upload all resources files generated or required by the slides.