[IPython-dev] extension to support reStructuredText. how to start?

Martín Gaitán gaitan at gmail.com
Sun Jun 22 20:18:36 EDT 2014


Hi everybody.

Last year I proposed a pull request [1] that added support to
restructuredText in the notebook.  This was dismissed, but with a  very
interesting debate of core commiters [2]

The idea behind my PR isn't very elegant, but solves the main obstacle: as
rst is a document wide markup (i.e. it needs to parse the whole document to
add semantic to each syntax element), we can't render rst cells
individually. The other point addressed was that there isn't a
restructuredtext parser in javascript, so we need to render in the backend.

the trick was concatenate every cell as a document adding a mark (a
comment), process it in the backend via doctutils (I did in the server
instead the kernel, wrongly), split the output by those marks, and then
update each cell with its corresponding chunk.

As I'm a heavy rst advocate [3] I would like to implement this as an
extension. I was looking for some example of a "render hook" based on raw
data, but I couldn't find one.
I've found instead the minrk's "gist" extension [4] which use a "comm"
between the notebook and the kernel, but I couldn't move forward much.

So, where should I start?
thanks


[1] https://github.com/ipython/ipython/pull/4301
[2] https://www.youtube.com/watch?v=TB7JRe68k84#t=3028
[3] https://mgaitan.github.io/en/posts/the-reStructuredText-processor.html
[4] https://raw.github.com/minrk/ipython_extensions/master/gist.py

-- 
mgaitan.github.io
textosypretextos.com.ar <http://textosyprextextos.com.ar>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140622/219aab35/attachment.html>


More information about the IPython-dev mailing list