ramnathv / slidify

Generate reproducible html5 slides from R markdown
http://www.slidify.org
843 stars 339 forks source link

Add option to publish as gist #267

Closed ramnathv closed 10 years ago

ramnathv commented 10 years ago

I realized that gists offer a powerful way to publish a slidify deck. It is in-between Rpubs and github, as it allows single file, but can also take more external files in the same folder.

Viewing slide decks on gist, is easy using http;//rawgithub.com. Here is an example

patilv commented 10 years ago

Hi Ramnath, I'm trying to publish a slidify presentation but am running into some difficulty (windows 8 computer). With Rpubs knit HTML + publish), I get:

Error in function (type, msg, asError = TRUE)  : 
SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Calls: rpubsUpload ... <Anonymous> -> .postForm -> .Call -> <Anonymous> -> fun
Execution halted 

I wasn't sure how to setup the github method; I have their windows client. Thanks for the help.

ramnathv commented 10 years ago

To publish to RPubs, you can try setting options(rpubs.upload.method = "internal") . I have seen the error you report before, and in most cases this change worked.

To publish to github, you can either do it using the publish function in which case you need to have SSH access setup. If you are using their Window's client, I think all that you need to do is Sync the repo. I am going to check how that works and post back with an update.

ramnathv commented 10 years ago

I just checked and it is actually super simple. Here are the steps to follow

  1. Run author("mydeck") to bootstrap your slide deck.
  2. Edit index.Rmd with your slides.
  3. Run slidify("index.Rmd") to convert to HTML

Once you are ready to push to github, open your Github Client and follow the steps below.

  1. Use File > Add Local Repository to add mydeck as a local repository.
  2. Fill in a commit message and commit the changes made to the repo.
  3. Use Repository > Publish to publish your deck to Github.

You can watch this screencast, if the steps are not clear. Although I make use of the Mac Client for Github, it should work the same way with Windows.

patilv commented 10 years ago

Super. Got the github thing working. I'm using the impress.js framework. Now, that is rendered properly using rawgithub but when using htmlpreview, impressjs is indicating that the browser is not compatible. Something that might be of interest to others..I am still running into the Rpubs error - same message. (I am assuming the options setting you mention goes into the console.)

ramnathv commented 10 years ago

See this discussion for where to put this option. TLDR, you need it in your .Rprofile for things to work.

Thanks for letting me know about htmlpreview. I still don't see why you would need rawgithub? Is this for serving the html from a gist? For github, slidify automatically configures the repo as a gh-pages branch, so you should be able to view it directly.

Let me know.

patilv commented 10 years ago

Yes, used rawgithub to render the index.html.stored in the folder - it worked though. I will check on the rpubs and the slidify github config in a bit.

ramnathv commented 10 years ago

Okay. Just so that you know, if you used author to initialize your slide deck, and published it to github to a repo named mydeck, then you will be able to view it at

http://patilv.github.io/mydeck

This logic holds for any files in a repo on the gh-pages branch. We are not specifying index.html here, since it is what the server would look for by default if nothing is specified.

patilv commented 10 years ago

Okay... this is what I try and the output with the basic deck...Nothing shows up on the gh page. I had setup an empty repo "mydeck" author("mydeck") Creating slide directory at mydeck... Copying files to mydeck... Finished creating slide directory... Switching to slide directory... Opening slide deck...

slidify("index.Rmd")

processing file: index.Rmd |.................................................................| 100% ordinary text without R code

output file: index.md

Copying files to libraries/frameworks/io2012... Copying files to libraries/highlighters/highlight.js...

publish("patilv","mydeck") Initializing Git Repo Checking out gh-pages branch... Adding .nojekyll to repo Publishing deck to mydeck/patilv You can now view your slide deck at http://mydeck.github.com/patilv

ramnathv commented 10 years ago

You have switched the arguments for username and repo. You should use

publish("mydeck", "patilv")

I am surprised that there was no error message when you tried to publish it the other way around.

Can you try this and let me know what happens.

ramnathv commented 10 years ago

So, here is how you can check this. I am assuming you have an empty repo on github with the name mydeck2.

library(slidify)
author("mydeck2")
slidify("index.Rmd")
publish("mydeck2", "patilv")
patilv commented 10 years ago

Thanks for the patience but I am saturated now--- https://github.com/patilv/yetanotherdeck, (published using the windows gh client). index.html works through raw.github, but http://patilv.github.io/yetanotherdeck doesn't...I'm missing some intermediate step, but for now, have the raw github thing to rely on. I'll retry later. I guess I got used to publishing charts... can this be tweaked like that? publish ("mydeck") -- it asks for user and passwd and we're done ? :-) Thanks again.

ramnathv commented 10 years ago

The trouble here is that you did NOT create yetanotherdeck on github as an empty repo, but instead with a master branch. That is the reason when you push to github, it is getting pushed to the master branch, which cannot serve web pages.

screen shot 2013-09-09 at 8 02 29 pm

From this image, I see that you have created mydeck3, and I see that it is an empty repository. If you push your deck to mydeck3, it should now be created as a gh-pages branch which will be able to serve web pages.

I can understand this can be frustrating. I wish there were a simpler way out :)

About your suggestion on options like rCharts, I will make a note and implement them. It is fairly straightforward to do that.

patilv commented 10 years ago

Ramnath, I went ahead and used the raw github approach for a presentation I just made. I'll pick up the publishing approach on my next one. Thanks for your help on this. The presentation used the impressjs framework and has a few rCharts in it (again, coding is imperfect, but wanted to get the job done): http://analyticsandvisualization.blogspot.com/2013/09/why-use-r-for-data-analysis.html

ramnathv commented 10 years ago

That presentation looks awesome. Are you gonna tweet about it? If not, can I tweet a link. It is a great example of using ImpressJS + rCharts.

Well, whatever gets the job done and works is good! Ping me if you want to get the gh-pages way of getting it done, since rawgithub links can sometimes be a pain to work with :)

patilv commented 10 years ago

Thanks very much, please go ahead and tweet the link, if you think that'll be good a example for the combo of ImpressJS and rCharts. I am not really active on twitter. I'll write separately regarding the gh pages and gallery building for dimple/others.

timelyportfolio commented 10 years ago

I would strongly encourage making a gh-pages branch like this fork. Let me know if you need help.

Great slideshow.

patilv commented 10 years ago

Yes, I do need help, I just wrote to Ramnath for offline help. I think rawgithub is messing it up for me.

patilv commented 10 years ago

@timelyportfolio: Thanks for the feedback. That entire mess is fixed --- (actually, @ramnathv fixed it).

ramnathv commented 10 years ago

Publishing to gist has been implemented in dev.

patilv commented 10 years ago

Thanks.