Skip to content

Newlines not treated as whitespace in emphasis pattern #783

Closed
@waylan

Description

@waylan

The following input is correctly not a list as there is no blank line between the first and second lines:

not a list
* list item 1
* list item 2
* list item 3

However, now that we have list-like syntax, the inline patterns make a mess of it and we get this output:

<p>not a list
<em> list item 1
</em> list item 2
* list item 3</p>

It seems that * list item 1\n* is incorrectly being identified as em. However, the reference implementation renders that as:

<p>not a list
* list item 1
* list item 2
* list item 3</p>

See Babelmark for comparison.

If we remove the newlines:

not a list * list item 1 * list item 2 * list item 3

Then things work as they should (see Babelmark):

<p>not a list * list item 1 * list item 2 * list item 3</p>

Which suggests that the problem is that we are not properly accounting for newlines as being whitespace somewhere in an inline pattern.

Note that Commonmark differs from Markdown here in that it recognizes the list without the blank line. In fact, the Commonmark spec acknowledges that this behavior is different from Markdown. This issue is not about that. See #338 for that discussion. Please keep this discussion on point.

Finally, this issue was first reported on StackOverflow by user Minato.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.confirmedConfirmed bug report or approved feature request.coreRelated to the core parser code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions