ipython/nbconvert — pull request #3 by slojo404 (2012-03-13 07:49:46+00:00)
Title: Rst2ipynb

First pass writing a docutils writer/translator to convert rst to ipynb.

Basic strategy is to create a header_cell from any titles encountered from an rst,
create a markdown cell for any paragraphs encountered and
a code cell for any literal-block encountered.

An additional step for the code cell is that the we only copy over lines beginning with >>>
so that we don't put example output in the code block. Further we strip out the >>>

python rst2ipynb.py filename.rst > filename.ipynb

Lots more to do but still getting familiar with the basics of docutils.

I'll start creating issues to help track all the things that are missing tomorrow but want to get down a few thoughts here while I remember them.

I've been using a sci-kits learn tutorial as an example file to work with and one issue is that the sphinx ref directive causes an issue resulting in additional paragraphs generated for each ref indicating docutils does not recognize the directive.

Current work-a-round is to just filter them out but there likely is a more elegant solution. There is also the issue of superflous refs in the mardown cells.

I don't have any exhaustive implementation of visit methods to cover all possible rst directives which means a given rst might throw an exception indicating as such. I'll fix that tomorrow or this weekend.

Lots more I'm sure but it's a start.