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

Formatting isn't applied if a line ends with exclamation mark, asterisk(s) and backslash #161

Closed
roythedev opened this issue Apr 18, 2019 · 3 comments

Comments

@roythedev
Copy link

Issue

  • When ending a formatted text line with "!*\", "!**\" or "!***\" the wanted bold, italic or combination formatting isn't applied for backslash forced breaks.
  • Escaping the exclamation mark doesn't help.
  • Ending the line with two spaces instead of backslashes to add forced breaks works as expected.
  • Issue is able to be replicated on https://spec.commonmark.org/dingus/

Test case (copy to the dingus)

***Failed to be bold and italic!***\
text

**Failed to be bold!**\
text

*Failed to be italic!*\
text

@jgm
Copy link
Member

jgm commented Apr 18, 2019

Simpler example:

*hi!*\!

becomes

<p>*hi!*!</p>

@jgm
Copy link
Member

jgm commented Apr 18, 2019

I do think this is a parser bug (also in cmark). The spec says:

A right-flanking delimiter run is a delimiter run that is (1) not preceded by Unicode whitespace, and either (2a) not preceded by a punctuation character, or (2b) preceded by a punctuation character and followed by Unicode whitespace or a punctuation character. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.

So the second * in this example should count as right-flanking, assuming that the \ is considered a punctuation character. (If we substitute another punctuation character, it works: e.g. *hi!*@.)

My guess is that \ is not being considered a punctuation character, and that is the underlying problem.

@jgm
Copy link
Member

jgm commented Apr 18, 2019

Clarification: cmark does not have this bug.

@jgm jgm closed this as completed in 5eebfd3 Apr 18, 2019
taku0 added a commit to taku0/cmark-el that referenced this issue Apr 20, 2019
Closes commonmark/commonmark.js#161.

commonmark/commonmark.js@5eebfd3
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Thu Apr 18 09:49:15 2019 -0700
taku0 added a commit to taku0/cmark-el that referenced this issue Apr 20, 2019
Closes commonmark/commonmark.js#161.

commonmark/commonmark.js@5eebfd3
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Thu Apr 18 09:49:15 2019 -0700
taku0 added a commit to taku0/cmark-el that referenced this issue Apr 20, 2019
Closes commonmark/commonmark.js#161.

commonmark/commonmark.js@5eebfd3
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Thu Apr 18 09:49:15 2019 -0700
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

No branches or pull requests

2 participants