[IPython-dev] Where to look: extending Markdown, and including NB in other webpages

Matthias BUSSONNIER bussonniermatthias@gmail....
Sun Jan 13 03:08:55 CST 2013


HI, 

Le 12 janv. 2013 à 22:56, Stian Håklev a écrit :

> Hi. I'm coming from the Ruby world,

You might be interested /could help with 
https://github.com/ipython/ipython/pull/2643

> but have been blown away by IPython and Notebook, as well as the incredible support for scientific computing, statistics etc. I'm a PhD student in education, and have decided to try to use IPython for my statistical analysis, instead of SPSS etc. Also very interested in open scholarship/reproducible research etc. 

> I've been working on an "open scholar" workflow, using Ruby+AppScript to integrate a citation manager, PDF reader, and Dokuwiki into a pretty neat system (see http://reganmian.net/wiki/researchr:start). I'm currently thinking about how to integrate IPython with my workflow. I have two ideas, and in both cases, I'd love a little pointer as to where to look (I realize I'll have to dig through some code, and learn more Python, to get there).
> 
> 1. How easy is it to write a "plugin" for the Markdown parser? In my wiki, [@citekey] is replaced with a proper citation, with a link to the relevant article page etc. I also wrote a plugin for Wordpress to do the same (they get the info from a pre-processed JSON file). For WordPress this is as easy as a small php file with a regexp. How would I do some similar "post-processing" on Markdown cells? 

Shouldn't be too hard, But IMHO it will probably not be accepted in the core. If you need modification for plugin those might be accepted like 
a prerender-hook or a post render hook. 

If you do such modification like that, be aware that they will probably be needed for nbconvert :
https://github.com/ipython/nbconvert

> 2. A more ambitious idea would be to try to integrate Notebook with Dokuwiki. My idea would be to have a php plugin which started an IPython instance, and then sent each code block on the page to the server, and got back output, which was written to the page (which is then cached, so it doesn't have to be re-run until the page changes). 

I suggest you have a look to nbconvert which is beeing rewritten right now, so ask before sending any PR
or extending it for yourself as the API will probably change soon.

> I was thinking of having a markup like
> <IPython>plot(x,y)</IPython> - possibly also with the option of hiding the Python code and only showing the output (this would make it more similar to knitr), or also showing the color highlighted Python code...
> 
> I'm not sure how easy this would be - I need to understand more about how to start and communicate with an IPython kernel, and what exactly it sends back (ie. how much of the HTML processing etc gets done in Notebook, as opposed to in the kernel, etc). Has anyone else tried to do something similar? 

IMHO nbconvert is what you are looking for. It takes an ipynb file and generate HTML/rst/markdown to be integrated. 

> Again, pointers to where I should start to look would be useful! I will of course share anything I come up with!
> 
> Thanks again for an amazing project. I look forward to the first Coursera course (or similar) using IPython and Numpy+Scipy+Pandas instead of R (I am thinking of trying to take one of the courses, and doing all the exercises in IPython instead). 

Thanks ! 
Matthias


More information about the IPython-dev mailing list