I’ve found a small disagreement between the spec and commonmark.js. commonmark.js identifies the following as a setext heading within a list item:
1. Foo
Bar
====
The spec defines lazy continuation lines such that they must contain paragraph continuation text:
If a string of lines Ls constitute a list item with contents Bs, then the result of deleting some or all of the indentation from one or more lines in which the next character other than a space or tab after the indentation is paragraph continuation text is a list item with the same contents and attributes. The unindented lines are called lazy continuation lines.
Paragraph continuation text is text that will be parsed as part of the content of a paragraph, but does not occur at the beginning of the paragraph.
The language here disqualifies the text of a setext heading title from being paragraph continuation text, seeing as setext headings are a distinct type of leaf block (rather than containers around paragraphs). As a reader of the spec, it seemed to say very clearly that paragraphs and only paragraphs can contain lazy continuation lines, and moreover that setext heading titles are not paragraphs.
However, there are other places in the spec that suggest contradictory intent, such as language preceding example 92 that reads
The setext heading underline cannot be a lazy continuation line in a list item or block quote:
The above seems to imply that lazy continuation lines before the underline are alright, since no analogous statement is made about this case. I’d guess this is what was intended, as it seems more consistent with the rest of CommonMark. It is even slightly nicer to implement since it allows paragraph and setext heading parsers to share code.
Block quotes are similarly afflicted. Their analogous laziness rule disqualifies setext heading titles from being considered paragraph continuation text. Yet commonmark.js also sees this as a heading inside a block quote:
> Foo
Bar
> ===
This is potentially very easy to fix. The definition for paragraph continuation text could be changed to read
Paragraph continuation text is text that will be parsed as part of the content of a paragraph or the title of a setext heading, but does not occur at the beginning of that paragraph or title.
Then there would be no need to change the implementation.
Thank you for your time.