Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Last active December 26, 2015 12:59
Show Gist options
  • Save ramnathv/7155503 to your computer and use it in GitHub Desktop.
Save ramnathv/7155503 to your computer and use it in GitHub Desktop.
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.

@patilv
Copy link

patilv commented Nov 7, 2013

First experience using this... just published 3 pages using slidify as gists using these instructions... http://bit.ly/18aWx3e... Experience: Base R version went perfectly... rCharts required me to publish the individual charts first and include them as iframes... the ggplot2 version didn't send the plots... they appeared blank. The current implementation is showing the ggplot2 page from my dropbox folder and the font is off.

@sahilseth
Copy link

Hi I have tried publishing at multiple places, each gives a unique problem:
gist:
http://bl.ocks.org/sahilseth/raw/0ea6eebdb2d2c93da4e0
this should be displayed using the shower theme

using gh-pages:
http://sahilseth.github.io/flowr/flowr-demo.html

It works perfectly from the original folder on my end.

Any hints/help most appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment