# xaringan: slide decks as R Markdown that live in the browser

> xaringan is an R package that renders presentations with remark.js through R Markdown, so a deck is a self-contained HTML file rather than a PDF. It trades Pandoc's Markdown extensions for remark.js syntax, and the design leans on CSS rather than on a slide layout engine.

**yihui/xaringan** — Presentation Ninja 幻灯忍者 · 写轮眼

- Repository: https://github.com/yihui/xaringan
- Website: https://slides.yihui.org/xaringan/
- Stars: 1,524 · Forks: 273
- Language: CSS
- License: NOASSERTION
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/yihui-xaringan

## A presentation is one HTML file, not a rendered artefact

xaringan is an R package for creating slideshows with remark.js through R Markdown, and that combination decides everything about how you work with it. Because remark.js is a browser-based slideshow engine, the output of knitting a deck is a single HTML file that carries the slides, the styling and the JavaScript in one artifact. There is no PDF to produce, no LaTeX toolchain to install, and no export step between writing and presenting. The audience for this is a statistician, analyst or student who already writes R Markdown and wants slides that are as easy to share as a file attachment, and who is willing to treat CSS as the styling language rather than treating the slide layout as a fixed template. The project documentation is itself presented as a slideshow at slides.yihui.org, with a Chinese version at slides.yihui.org/xaringan/zh-CN.html, and there is a longer treatment in the R Markdown book, Chapter 7. The package name comes from the Sharingan, a dōjutsu in Naruto with two abilities, the Eye of Insight and the Eye of Hypnotism, which is a joke about what a presenter needs rather than a technical claim.

## The R Markdown output format is moon_reader()

The main output format in the package is moon_reader(), and every configuration knob lives on that function, documented on the R help page ?xaringan::moon_reader. The name is a reference to the RStudio addin of the same purpose, and it is the single entry point you put in the YAML header of an R Markdown document. The mechanics are the standard R Markdown ones: you write slides separated by the remark.js separator syntax, the package processes the document through the R Markdown pipeline, and the result is HTML. The package has simplified several things compared to the official remark.js guide, according to the project text. You do not need a boilerplate HTML file, you can set the autoplay mode via an option of moon_reader(), and LaTeX math basically just works. The autoplay option in particular is a reminder that this is a browser engine with a presentation mode built in, not a static document. A template ships with the package, so an empty starting point is one command away, and the RStudio route makes it nearly automatic.

## Installing it and getting a deck on screen

The documented install path uses remotes to pull the package straight from GitHub:

```r
remotes::install_github('yihui/xaringan')
```

The package is also published on CRAN, which the project badges point to, so a standard install from a CRAN mirror works as well. In RStudio the route is even shorter: go to File, then New File, then R Markdown, then From Template, then Ninja Presentation, and you get an R Markdown example document. Press the Knit button to compile it. The alternative to knitting is the RStudio Addin Infinite Moon Reader, which gives a live preview of the slides, so that every time you update and save the Rmd document the slides reload automatically, with the caveat that the Rmd document has to be in focus when you click the addin. If the template or the addin does not appear in RStudio, the project points to issue #2. That live loop is the practical reason to use RStudio with this package at all, since editing CSS by hand and refreshing a browser is a slower cycle than letting the addin reload on save. The generated file can also be opened directly, because the output is plain HTML.

## remark.js syntax, not Pandoc Markdown, and what that costs

The constraint that decides whether xaringan fits your writing habits is stated directly in the project text: remark.js does not support Pandoc's Markdown, so you will not be able to use any fancy Pandoc features, and the project adds that this is probably fine for presentations. In practice this means a deck written for xaringan is not portable to a plain R Markdown HTML document, and any habit of relying on Pandoc-specific syntax has to be dropped. The escape hatch is raw HTML, and the project explicitly recommends it for the things Markdown cannot express, giving the example of a knitr::kable call with the html format. The remark.js Wiki is where the slide formatting and the keyboard shortcuts are documented, and the xaringan wiki is the place to look for CSS that alters the appearance of a presentation. That division is the key to understanding the design: the layout and the interaction model come from remark.js, the appearance comes from CSS, and the package deliberately stays out of the way in both. The one place where you leave remark.js entirely is math, and there the project is unusually confident that LaTeX math basically just works.

## CSS is the styling layer, and beginners will feel that

The project is direct about the skill it expects. As the package title indicates, the package is designed for ninja, and if you are a beginner of HTML and CSS you may have to stick with the default CSS, which the project notes is not bad. The more you know about CSS, the more you can achieve, and the claim that the sky is your limit is about the CSS itself rather than about the package. This is an unusual posture for a slide tool and it has a real consequence. There is no fixed set of layouts, no theme picker and no place where a title slide is guaranteed to look the same as it does in someone else's deck, because the appearance of a deck is essentially the stylesheet you ship with it. The trade-off runs the other way too. A deck that renders in a browser can be styled in ways a fixed template never allows, including layouts that respond to the viewport, and the same HTML works on a projector laptop, a tablet and a phone without a separate mobile edition. The wiki is suggested as the first stop before opening an issue, and simple usage questions can also be posted on stackoverflow with the #xaringan tag.

## yolo: true skips the safety checks most people never want

Among the few configuration options the project actively recommends, one stands out: the option yolo: true under xaringan::moon_reader in the YAML metadata of your R Markdown document, credited to Karl Broman. The name says what it does, and the project asks readers to try it, which suggests the default behaviour is more cautious than most people want. What is checked in the default path is not spelled out in the project text, so the honest description is that the option exists, is documented at the linked issue, and is recommended by the author. It is a good example of a project whose documentation is distributed across several places: the README for the shape of the workflow, the R help page for the configuration surface, the wiki for styling, the remark.js wiki for the syntax and shortcuts, the R Markdown book chapter for the long form, and issue threads for individual options. The licence file and the repository structure follow the same pattern of an ordinary CRAN package, with a DESCRIPTION file, a NAMESPACE, an R directory, man pages, tests, vignettes and a NEWS.md file recording changes.

## Conclusion

Adopt xaringan if you already write R and want slides that are one HTML file you can host anywhere, share by email, or open offline, and if you are comfortable writing CSS to control the look. Do not adopt it if you need Pandoc Markdown extensions, a PDF export workflow, or a layout you expect to be fixed without touching stylesheets. Verify first that the version you install matches the CSS you are copying, since the package's own wiki is the place to look for styling advice, that remark.js keyboard shortcuts match your presenting habits, and that any LaTeX math and knitr output render as expected, because remark.js does not support Pandoc's Markdown.

## FAQ

### How do I install xaringan and create my first deck?

Install the package with remotes::install_github('yihui/xaringan'), or from CRAN, then in RStudio choose File, New File, R Markdown, From Template, Ninja Presentation and press Knit. You can also live preview with the Infinite Moon Reader addin, which reloads the slides each time you save the Rmd document.

### Can I use Pandoc Markdown features in an xaringan deck?

No. remark.js does not support Pandoc's Markdown, so Pandoc specific features are unavailable. The project notes this is probably fine for presentations, and suggests raw HTML for anything you need that basic Markdown cannot express, such as a knitr::kable call with the html format.

### How do I change the appearance of xaringan slides?

With CSS. The project has a wiki for using CSS to alter the appearance of a presentation, and it suggests checking the wiki before opening an issue. The default CSS is a reasonable starting point, and the more CSS you write the more you can change.

### Where do I configure xaringan options?

The main R Markdown output format is moon_reader(), and its help page ?xaringan::moon_reader lists all possible configurations. Options go in the YAML metadata of your R Markdown document, and the project also suggests trying yolo: true under xaringan::moon_reader.

## Sources

- [Issues](https://github.com/yihui/xaringan/issues)
- [Project website](https://slides.yihui.org/xaringan/)
- [README](https://github.com/yihui/xaringan/blob/master/README.md)
- [Releases](https://github.com/yihui/xaringan/releases)
- [yihui/xaringan on GitHub](https://github.com/yihui/xaringan)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/yihui-xaringan
