Example 60 is not an html block?

I was working on making marked.js to comply with commonmark as much as possible when I ran into the following thing. Example 60 tells us:

Since indicators of block structure take precedence over indicators of inline structure, the following are setext headings:

<a title="a lot
---
of dashes"/>

My implementation parses this as a whole HTML block of type (7) (open tag), and I can’t find a reason why it shouldn’t.

  1. Start condition: line begins with a complete open tag or closing tag (with any tag name other than script, style, or pre) followed only by whitespace or the end of the line.
    End condition: line is followed by a blank line.

It does not say that the tag must be on a single line, maybe I’ve missed something.

An open tag consists of a < character, a tag name, zero or more attributes, optional whitespace, an optional / character, and a > character.

If the open tag must lay on a single line, should I create a “special” attribute parsing rule that does not allow newlines?

Yes it does:

line begins with a complete open tag or closing tag.

Federico Soave noreply@talk.commonmark.org writes:

It does not say that the tag must be on a single line, maybe I’ve missed something.

It does, though maybe this isn’t completely clear:

  1. Start condition: line begins with a complete open tag or closing
    tag (with any tag name other than script, style, or pre) followed only
    by whitespace or the end of the line.

Note the word “complete.” You don’t have a complete opening tag
followed by end of line.

1 Like

That’s what I was suspecting.
It fooled me because

<a title="a lot
---
of dashes"/>

is a complete tag, it just happens to sit on multiple lines. Also, I couldn’t find a clear definition of what a complete/partial tag is, even though that should be intuitive enough.

Your choice whether to review the phrasing or not, thanks anyhow for the prompt answer.
To fix this parsing error, I had to disallow newlines inside html quoted attribute values, which conflicts with their definition.