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

(Intentional?) inconsistency between 4.6 block HTML and 6.6 raw HTML comments #712

Closed
wooorm opened this issue Jun 14, 2022 · 10 comments · Fixed by #713
Closed

(Intentional?) inconsistency between 4.6 block HTML and 6.6 raw HTML comments #712

wooorm opened this issue Jun 14, 2022 · 10 comments · Fixed by #713

Comments

@wooorm
Copy link
Contributor

wooorm commented Jun 14, 2022

The block HTML algorithm here allows <!-->, <!--->, etc, as comments.
These comments are also fine by the HTML parser (13.2.5.44, case for U+002D).
(note there are a couple of cases such as <!> and <!-> which HTML also allows but sees as parse errors, I am not talking about these).

The “inline” algorithm here does not allow <!--> or <!--->. They look a lot like comments, so I don’t really expect people to depend on these characters to be text. And it’s inconsistent with blocks. Can we change the spec to allow them?

I can do the work

@jgm
Copy link
Member

jgm commented Jun 14, 2022

Yes, I'm in favor.

@wooorm
Copy link
Contributor Author

wooorm commented Jun 14, 2022

Good to hear! One thing that I was wondering: -- in a comment is the same. For example, <!-- some stuff -- some more stuff -->. OK too?

@jgm
Copy link
Member

jgm commented Jun 14, 2022

If I recall, we deliberately simplified the comment parsing (even though this diverts from HTML standard). I don't remember why, though. I'm okay with implementing something more standard as long as it doesn't increase complexity too much, both in the spec and in parsers.

@wooorm
Copy link
Contributor Author

wooorm commented Jun 14, 2022

I wouldn’t know why that was the case! Perhaps if you care more about XML than HTML?

In my case, this just removes states in my state machine that are needed for inline, but not for block.
I can see -- in comments being used by humans, so that might even be considered a bug fix.

wooorm added a commit to wooorm/commonmark-spec that referenced this issue Jun 14, 2022
*   This limitation is not imposed by block comments
*   This limitation is not imposed by HTML
*   This limitation is not expected to be depended on by authors

Closes commonmarkGH-712.
@jgm
Copy link
Member

jgm commented Jun 14, 2022

For reference, the HTML5 spec for comments:
https://html.spec.whatwg.org/multipage/syntax.html#comments

@jgm jgm closed this as completed in d5ddfae Sep 8, 2022
@wooorm
Copy link
Contributor Author

wooorm commented Sep 8, 2022

Thanks for merging this, John!

@jgm
Copy link
Member

jgm commented Sep 8, 2022

Reopening until we get the issue of <!--> and <!---> (not to mention <!-- hi -->) sorted out. See comments on linked PR.

@jgm jgm reopened this Sep 8, 2022
@jgm
Copy link
Member

jgm commented Sep 8, 2022

I think an inconsistency between the block and inline cases is okay, given that the spec for block HTML allows invalid HTML.

@jgm
Copy link
Member

jgm commented Sep 8, 2022

However, allowing -- inside HTML comments is a change worth making.

@wooorm
Copy link
Contributor Author

wooorm commented Sep 8, 2022

commented in the PR: #713 (comment).

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

Successfully merging a pull request may close this issue.

2 participants