Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
step- opened this issue Nov 19, 2023 · 3 comments
Open

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

step- opened this issue Nov 19, 2023 · 3 comments

Comments

@step-
Copy link

step- commented Nov 19, 2023

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".

@jgm
Copy link
Member

jgm commented Nov 19, 2023

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>

@step-
Copy link
Author

step- commented Nov 19, 2023

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

@jgm
Copy link
Member

jgm commented Nov 20, 2023

Yes please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants