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

Newlines not treated as whitespace in emphasis pattern #783

Closed
waylan opened this issue Feb 5, 2019 · 0 comments
Closed

Newlines not treated as whitespace in emphasis pattern #783

waylan opened this issue Feb 5, 2019 · 0 comments
Labels
bug Bug report. confirmed Confirmed bug report or approved feature request. core Related to the core parser code.

Comments

@waylan
Copy link
Member

waylan commented Feb 5, 2019

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.

@waylan waylan added bug Bug report. core Related to the core parser code. confirmed Confirmed bug report or approved feature request. labels Feb 5, 2019
waylan added a commit to waylan/markdown that referenced this issue Feb 7, 2019
All whitespace characters should be treated the same by inline patterns.
Previoulsy, emphasis patterns were only accounting for spaces, but not
other whitepsace characters such as newlines. Fixes Python-Markdown#783.
waylan added a commit that referenced this issue Feb 7, 2019
All whitespace characters should be treated the same by inline patterns.
Previoulsy, emphasis patterns were only accounting for spaces, but not
other whitepsace characters such as newlines. Fixes #783.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report. confirmed Confirmed bug report or approved feature request. core Related to the core parser code.
Projects
None yet
Development

No branches or pull requests

1 participant