Self contained html for xarigan slides

I don't think you can create self-contained presentation using xaringan. See https://bookdown.org/yihui/rmarkdown/xaringan-preview.html

Due to technical difficulties (remark.js does not use Pandoc but renders Markdown in real time in the browser), it is hard to implement the self-contained mode well. If you have to publish the slides to a web server, but it is not convenient for you to upload all the dependencies, xaringan may not be a good choice for you. If you use GitHub Pages or Netlify, this may not be a big problem (you commit or upload all files).

However, you can download all the dependencies locally and create an offline bundle if needed.
You can use xaringan::summon_remark() to download what is required see Presentation Ninja and ?xaringan::moon_reader help page

Local images that you inserted via the Markdown syntax ![](path/to/image) will not be embedded into the HTML file when self_contained = TRUE (only CSS, JavaScript, and R plot files will be embedded). You may also download remark.js (via summon_remark() ) and use a local copy instead of the default chakra argument when self_contained = TRUE , because it may be time-consuming for Pandoc to download remark.js each time you compile your slides.

lib_dir argument from ?html_document can be used to control where the libraries are downloaded.

See also
https://forum.posit.co/t/sharing-xaringan-html-files-and-keeping-embedded-images/22798/6

If you need a portable file, you could try printing to pdf using Chrome browser and pagedown::chrome_print()

Hope it helps.

3 Likes