block by ramnathv 7155503

Publish Slidify Decks as Gists

Slidify now allows you to publish your slide decks as gists. You will need the dev version of slidify to use this feature.

require(devtools)
install_github(c('slidify', 'slidifyLibraries'), 'ramnathv', ref = 'dev')

Let us first create a directory for our slide deck and open an index.Rmd file to author our presentation.

dir.create('mydeck')
setwd('mydeck')
file.edit('index.Rmd')

Shown below is a sample index.Rmd file. Note that you need to set mode: standalone in the YAML front matter (or page properties), in order to be able to publish your deck as a gist. The standalone mode ensures that all library assets are served from an online CDN, thereby requiring you to only upload the html file.

---
title       : Testing Blocks
author      : Ramnath
mode        : standalone
---

## Read-And-Delete

1. Edit YAML front matter
2. Write using R Markdown
3. Use an empty line followed by three dashes to separate slides!

[Source](index.Rmd)

--- .class #id 

## Slide 2

Another Slide

> - Point 1
> - Point 2
> - Point 3

We can now slidify this deck and publish it as a gist. You will need to have the httr and rjson packages installed to be able to use this feature. In addition, you will also need a github account.

slidify('index.Rmd')
publish("My First Presentation", host = 'gist')

On publishing your slide deck, Slidify will return a url that will look like this

http://bl.ocks.org/{{username}}/raw/{{gistid}}

We use the excellent bl.ocks.org gist viewer built by Mike Bostock, the creator of d3.js to view the slide deck. Here is an example of a deck published as a gist.

By default, publishing as a gist only uploads files with the pattern index.*. You can override it by passing an explicit list of filenames to publish.

publish('My Second Presentation', filenames = c('myslides.Rmd', 'myslides.html'), host = 'gist')

This feature is still experimental, and I will appreciate any feedback/comments you might have, as you play with it.