Self contained html for xarigan slides

Hello everyone,

I always create my presentations with Rmarkdown using the xaringan package. When I knit my slides I obtain an html file that is not self contained. Is there a way to produce a self contained html file using xaringan?

I don't think you can create self-contained presentation using xaringan. See

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

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

Hope it helps.


Hi Christophe,

That is very useful indeed, many thanks.

I wanted to have a single portable file and print the slides to pdf was my initial solution but the only problem with this is that I will loose the incremental slides. Do you know of a way to print them in pdf and keep all the increments?

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