ivanov / vim-ipython

A two-way integration between Vim and IPython 0.11+
http://github.com/ivanov/vim-ipython
1.04k stars 163 forks source link

Interacting with a markdown representation of IPython notebooks #109

Open aaren opened 10 years ago

aaren commented 10 years ago

This is more of a brainstorm than an issue and I'd be interested to hear any thoughts.

I've been working on notedown recently and have got to the point where you can interchange between markdown and json representations of the notebook (including outputs)

You can create a notebook in the browser, play around and create some outputs, then convert that notebook to markdown, fiddle around in vim and convert back to .ipynb.

The basic markdown format for cells is this:

This is regular *markdown*. With [links](to/things) 
and whatever. Code cells look like this:    

```{.python .input n=1}
some code
json serialization of the outputs

i.e. two consecutive fenced code blocks with attributes. The output cell is optional.



i.e. using pandoc style code attributes. If don't give output cells, then you can use the `notedown --run` flag to pass the markdown through [runipy](http://github.com/paulgb/runipy) and generate the outputs.

My idea is to use this markdown representation as an interactive environment. e.g If your cursor is within an input code block and you hit `Shift-Enter`, then you take the code in the input cell and pass it to the kernel client. Then if your code makes a plot, this gets displayed in a separate window.

You could also use [runipy](http://github.com/paulgb/runipy) to generate an output cell which is appended after the input cell.

This way you could create valid notebooks with outputs without ever leaving vim.