jupyter / nbconvert

Jupyter Notebook Conversion
https://nbconvert.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.75k stars 569 forks source link

Markdown/html misparsing, break nbviewer. #550

Open Carreau opened 7 years ago

Carreau commented 7 years ago

The following (no trick, no hidden space, 3rd blank line is important)

<p></p>
<div>
<p></p>

</div>

get converted by nbconvert to

<p></p>
<div>
<p></p><p>&lt;/div&gt;</p>

Ouh ! bad escaped <div> and extra <p>s which become un matched and all hell break loose.

Almost any changes like add space in the first <p></p>... etc fixes it.

haven't tried on master, but will tomorrow.

mpacer commented 7 years ago

I think this is because mistune things the end of an raw HTML block is postceded by a blank line ((2 or more \n) even if it is not given a closing tag.