cmark icon indicating copy to clipboard operation
cmark copied to clipboard

why does this HTML block start and end on the same line?

Open step- opened this issue 2 years ago • 3 comments

Why is the HTML block (spec 4.6) closed on the same line when https://github.com/commonmark/commonmark-spec/blob/d5706b9553d4665ca730524323d484880440186c/spec.txt#L2368 says that

[An HTML block] ends with the first subsequent line that meets a matching end condition. (emphasis mine)

cmark << EOF
<!-- comment --> 0
1
-->
2
EOF
<!-- raw HTML omitted -->
<p>1
--&gt;
2
EOF</p>

I think cmark parses the comment as an HTML block. It couldn't be a raw HTML comment (spec 6.6) otherwise "0" would surface inside a <p>. So it seems that, contrary to the specification, the HTML block ends on the same line where it starts, instead of ending between "1" and "2".

step- avatar Nov 19 '23 13:11 step-

I think maybe the word "subsequent" is misplaced. There can definitely be HTML blocks that start and end on the same line, e.g.

<div></div>

jgm avatar Nov 19 '23 18:11 jgm

Should I open an issue about "subsequent" in the specification repo?

step- avatar Nov 19 '23 22:11 step-

Yes please.

jgm avatar Nov 20 '23 01:11 jgm