Incorrect .ipynb > .py > .ipynb roundtrip in simple and common cases
lebigot opened this issue · 0 comments
If we have an .ipynb notebook that contains a first Markdown cell:
First Markdown text.
Then a second Markdown cell with two paragraphs:
Second Markdown text…
… with a second paragraph.
Then converting to .py and then back to .ipynb fails: the second cell is considered (commented out) code. This is a problem, because this situation is very likely to happen.
Also, if the first Markdown cell is a header (# This is a header
), then the second Markdown cell is considered code through the roundtrip, which is a problem. Having a header cell and then some Markdown cell is another, common situation, for notebook.
PS: I tested this with the grst/ipymd version of ipymd
, which apparently didn't touch this part of the code. The pip version (of rossant/ipymd) fails with:
File "/…/anaconda/envs/py2/lib/python2.7/site-packages/ipymd/formats/notebook.py", line 80, in read
assert nb['nbformat'] >= 4
TypeError: string indices must be integers, not str