kjdev / hoextdown

Hoextdown is an extension to Hoedown
MIT License
23 stars 15 forks source link

HTML block parsing is broken in some cases #5

Closed jasharpe closed 9 years ago

jasharpe commented 9 years ago

I came across this snippet that does not render as you'd expect.

<h1>foo</h1>
<h2>bar</h2>

foo

bar

<h1>baz</h1>

This calls the BlockHtml callback once with

<h1>foo</h1>
<h2>bar</h2>

foo

bar

<h1>baz</h1>

and thus renders it exactly like that. It should render something like this instead:

<h1>foo</h1>

<h2>bar</h2>

<p>foo</p>

<p>bar</p>

<h1>baz</h1>

Note, this alternate Markdown snippet renders correctly, so there is something being handled poorly about the adjacent headers:

<h1>foo</h1>

<h2>bar</h2>

foo

bar

<h1>baz</h1>

This also renders correctly, so it's something to do with the header elements:

<div>foo</div>
<div>bar</div>

foo

bar

<div>baz</div>