commonmark / commonmark-spec

CommonMark spec, with reference implementations in C and JavaScript
http://commonmark.org
Other
4.89k stars 317 forks source link

Empty line needed after raw <h> tag. Is this a bug or feature? #767

Closed abalter closed 7 months ago

abalter commented 7 months ago

This results in the text getting wrapped in <p> tag:

<h1>Title</h1>

text below

https://spec.commonmark.org/dingus/?text=%3Ch1%3ETitle%3C%2Fh1%3E%0A%0Atext%20below%0A

This does not:

<h1>Title</h1>
text below

https://spec.commonmark.org/dingus/?text=%3Ch1%3ETitle%3C%2Fh1%3E%0Atext%20below

I don't see anything about that in the spec.

jgm commented 7 months ago

Look at the rules for raw HTML blocks. https://spec.commonmark.org/0.31.2/#html-blocks This is a type 6 HTML block, so it ends with a blank line.

abalter commented 7 months ago

@jgm -- Ok. Makes sense. I didn't quite parse that as "It's not over until there is a completely blank line". For some reason, I read it as "the rest of the line is blank". But it's clear now.