Now to generate presentations its pretty easy. You just need to start your r markdown document with the following:

---
title: "My Awesome presentation title"
author: Wil
date: 1 Jan 2021
output: revealjs::revealjs_presentation
---

This will automatically generate a title page for you with the above detail on it and you can then fill out the rest of the slides like the following:

# Section 1

## Part 1
bla bla bla

## Part 2
more bla bla bla

# Section 2

## Part 1
some bla bla bla

The above will create a reveal js presentation in a 2D style. This means Section 1 and Section 2 will be accessible via pressing left and right and inside these sections the Parts will be accessible by pressing up and down.

Inside each of the areas you can use any other markdown you want, images etc. As the output will be in html you can also insert html too (i.e. embedded youtube etc)

Theming

Another nice thing about reveal js is the built in themes which are selectable by adding the theme and highlight to the header.

---
output:
  revealjs::revealjs_presentation:
    theme: sky
    highlight: pygments
---

This selects from a list of pre-made themes which are:

  • default
  • simple
  • sky
  • beige
  • serif
  • solarized
  • blood
  • moon
  • night
  • black
  • league
  • white

Also you can set the style of code highlighting to the following (or null if you want to turn it off):

  • default
  • tango
  • pygments
  • kate
  • monochrome
  • espresso
  • zenburn
  • haddock

Slide transitions

You can also control the slide transitions with the following settings:

---
output:
  revealjs::revealjs_presentation:
    transition: fade
    background_transition: fade
---

transition is when moving up and down between slides and can be the following values:

  • default
  • fade
  • slide
  • convex
  • concave
  • zoom
  • none

background_transition is when moving a full page left and right and can be one of the following:

  • default
  • fade
  • slide
  • convex
  • concave
  • zoom
  • none

Slide backgrounds

You can change the background of a slide by using the data-background properties like the following:

## CSS color background {data-background=#ff0000}

## Full size image background {data-background="background.jpeg"}

## Video background {data-background-video="background.mp4"}

## A background page {data-background-iframe="https://example.com"}

More options

There are heaps of options to what you can do with revealjs from R Markdown. Reveal JS by itself also has pretty good markdown support. The reason I decided to use R Markdown though was to keep it consistent with the rest of my document generation strategy.

I suggest reading the documentation on R Markdown if you want to learn more about it.

RMarkdown Series