[IPython-dev] customize nbviewer : custom hook for getting Ipython notebook

Matthias BUSSONNIER bussonniermatthias at gmail.com
Sat Jan 25 04:42:51 EST 2014


Le 25 janv. 2014 à 03:10, Abhishek Pratap a écrit :

> Hey Guys
> 
> For the weekend fun  I am trying to find if there is a hook to plugin
> a function which can implement a custom method of getting a IPython
> notebook and pushed that for display by nbviewer.

No there are no hook (yet).

The way to do it would be to create a custom handler, 
and register it here :

https://github.com/ipython/nbviewer/blob/master/nbviewer/handlers.py#L723 

or like done here :

https://github.com/ipython/nbviewer/blob/master/nbviewer/app.py#L152



> In other words currently the nbviewer can work with a gist number or a
> public URL. In my local install of it I would like to plug in a
> function which can take an internal id, does the job of pulling the
> notebook and handover the file to downstream nbviewer code for
> display.
> 

If you like to make a PR that help with plugin, we would be happy to review it. 

You can probably rely on DotedNames, trait lets and/or import_string
and write your custom Handler as a package. 

Does it make sesns ?

-- 
Matthias




More information about the IPython-dev mailing list