I got tired of pasting URLs into nbviewer so I made a Chrome extension that will try to load your current page via nbviewer.
For example, if you are at https://gist.github.com/3778422 you can click the “Open in nbviewer” extension button and it will load http://nbviewer.ipython.org/3778422/ in a new tab. It also works for URLs ending in .ipynb
.
You can download the extension from the Chrome Web Store and see the code on GitHub.
I took the extension icon from the nbviewer favicon, so thanks to them for that! Thanks also for making something as awesome as nbviewer, it’s getting so I couldn’t live without it!
[…] Post navigation ← Previous […]
Hi there,
Nice job to have done that !
I have 1 question and 2 comment,
First the comments,
For https urls, nbviewer url are actually /urls/[ipynb url]
Both url/urls works for gists, but for some websites, the https protocol is mandatory.
Also you can POST the value `gistnorurl=your_url` to nbviewer.ipython.org/create/ and it should redirect to the right URL.
And If you allow me, I would be happy to put a link to this post on nbviewer frontpage.
Do you agree ?
Thanks for advertising nbviewer, and writing the chrome extension, feel free to write to the dev list if you think anything useful could be added to the frontpage.
–
Matthias
Hi Matthias, thanks for the info, I clearly wasn’t reading the nbviewer code close enough! I’ll update the https url as soon as I can.
I did play around with doing a POST but the problem is that it has to wait for nbviewer to do all the conversion and rendering before getting a response. It’s basically loading the page twice. Not that nbviewer is slow, but that makes the extension slightly less responsive. (Unlike using the requests library in Python, I couldn’t find a way in JavaScript to make a request not follow a redirect.)
Putting the logic in the extension also allows it to do nothing when the current page doesn’t match any of the regex, instead of opening an error page.
I’d be flattered to see this on the front page of nbviewer, please do! The bookmarklet I made for non-Chrome users would also probably be of interest.
When i have more time I’ll try to make a better api for nbviewer so that it send a json response with information.
In the meantime you might be interested in trying dev-version nbviewer-dev.herokuapp.com
My first thought was to post this comment on the bookmarklet page, but I might have use the wrong tabs, so i’ll put the link to the bookmarklet post when I’ve a little more time.
An API is an awesome idea, maybe when I have some more time I can help with that.
I’m a little low on bandwidth for API, but if you want to work on it please tell me, the production version of nbviewer is slightly different from the github one, but I can give you a link to it.
Also Nb icons :
https://github.com/ipython/ipython/tree/master/docs/resources
[…] to announce that there is now a Firefox add-on with the same functionality as the Open in nbviewer Chrome extension and bookmarklet. It can be installed via the Mozilla Add-ons directory. It will add an […]