Open in nbviewer Chrome Extension

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!

Open in nbviewer Chrome Extension

7 thoughts on “Open in nbviewer Chrome Extension

  1. Matthias Bussonnier says:

    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

    1. 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.

      1. seteniracarreau says:

        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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.