update regex for code blocks

Move away from consuming any number of blank lines before the code block
to forcing a single blank line or the start of the file.

i.e. code blocks have to be like

```code
x = 1
```

blah blah blah.

and not like
```code
x = 1
```
blah blah blah.

This is consistent with other markdown specs e.g. pandoc.

This required implementing a pre processor for text blocks (like we
already have for code blocks), which is currently only used to strip
excess blank lines from the start and end of the markdown text (which
are left there because of the new code regex).
wip: convert notebook to markdown

TODO:
- write code attributes into markdown
- strip outputs from notebook
- write outputs into json code cell

This allows us to roundtrip notebooks, i.e go from
markdown -> notebook json-> markdown with no change.

This is done using a slightly modified markdown template
`templates/markdown.tpl`. This is enabled via

    notedown example.ipynb --reverse

or equally

    ipython nbconvert example.ipynb --to markdown \
                                    --template templates/markdown.tpl
include cell outputs in markdown output

enable with `--with_outputs` switch

e.g.

    notedown r-examples/r-example.ipynb --reverse
    notedown r-examples/r-example.ipynb --reverse --with_outputs