The goal of surprisinglytidy is to make xaringan presentations a little easier to tweak and more flexible, including extending the functionality of CSS with Sass. It’s still very much in development.

Installation

surprisinglytidy is not yet available on CRAN. You can install it with devtools:

devtools::install_github("BenjaminWolfe/surprisinglytidy")

Example

knitr has 5 options to add classes to R output:

  • class.source
  • class.output
  • class.message
  • class.warning
  • class.error

These can make for some really beautiful output when wielded with nuance and finesse.

Unfortunately, they have at least 2 drawbacks for xaringan slides.

First none of these work well with xaringan. They set the class using Pandoc syntax, which is not recognized by remark.js:

```{class1 class2}
text here
```

Second, class.output does not add classes to plots.

If, instead of using the traditional xaringan Hello Ninja template (File –> New File –> R Markdown –> From Template –> Ninja Presentation), you use the Tidy Presentation template from this package, It will handle all those issues for you automatically. There is sample code for adding classes.

Next Steps

For now this is all very rudimentary. The presentation template, for example, is merely a copy of Yihui Xie’s “Hello Ninja” presentation, and the setup code in it is unpolished.

Furthermore, I haven’t even gotten to adding Sass functionality, which will be very exciting! But one step at a time. For now the package is up on Github. :)

Please let me know if you have any questions or requests, either for further development or for stronger documentation.

Best, Benjamin Wolfe