You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Touching italic/bold doesn't render right (v1.1.1 regression) #1754
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/// last char can't be a space, and final _ must preceed punct or \s (or endline)
endUnd: /[^\s]_(?!_)(?:(?=[*punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
Any PR should include tests for all valid permutations of this since evidently this has been fixed and broken over the years without being detected. i.e.: (all of these seem to generate valid tags on both sides within github)
I was hoping for @UziTech to jump in, as this regression may have been introduced by their PR (#1686). It may be more difficult for me, but I may try to check this in the future.
I don't see this case exactly in the GFM spec; the closest being Example #424. There's the comment below Test #420 that says an emphasis delimiter can't exist if the size of the delimiter runs containing the opening and closing delimiters sums to a multiple of 3, so in this case:
1te234st__ means we could have <em>te</em><strong>st</strong> but not 1te___st23 => <em>te___st_</em> which is what we have now.
I guess the best answer is to look at Babelmark which shows literally every implementation has a different answer. Commonmark is probably the "most accurate" though, and they get around the multiples of 3 rule by excluding the final underscore as per Example #467. Markdown 1.1.1 is probably the second best out of that list though :).
Activity
styfle commentedon Sep 3, 2020
Thanks for reporting this issue! It looks like it was fixed in v0.6.0 and broke in v1.1.1 🤔
This was mentioned in #1353 years ago but I'll elevate this to L1 since it was working for a couple years and regression in the latest release 👍
Would you like to create a PR to fix it? 🙂
calculuschild commentedon Sep 4, 2020
I suspect this can be fixed in this line by adding an asterisk to the "punctuation" group. Haven't tested it, but probably the place to look.
marked/src/rules.js
Line 182 in a41d8f9
Any PR should include tests for all valid permutations of this since evidently this has been fixed and broken over the years without being detected. i.e.: (all of these seem to generate valid tags on both sides within github)
_te_**st**test_te_*st*test*te*__st__test*te*_st_test__te__*st*test**te**_st_test**te**__st__test__te__**st**testfredck commentedon Sep 4, 2020
Found a few lines later:
marked/src/rules.js
Lines 191 to 192 in a41d8f9
fredck commentedon Sep 4, 2020
I was hoping for @UziTech to jump in, as this regression may have been introduced by their PR (#1686). It may be more difficult for me, but I may try to check this in the future.
UziTech commentedon Sep 4, 2020
I can take a look at it this weekend. Thanks for the test cases @calculuschild.
UziTech commentedon Sep 4, 2020
I started PR #1755 to fix this with @calculuschild's suggestion.
There are a few other cases I think we should test that are still failing such as
_te___st__=><em>te___st</em>_Or we could just consider these unspecified behavior.
I'll have to look closer at the spec to see if these cases should pass.
calculuschild commentedon Sep 4, 2020
I don't see this case exactly in the GFM spec; the closest being Example #424. There's the comment below Test #420 that says an emphasis delimiter can't exist if the size of the delimiter runs containing the opening and closing delimiters sums to a multiple of 3, so in this case:
1te234st__means we could have<em>te</em><strong>st</strong>but not1te___st23=><em>te___st_</em>which is what we have now.I guess the best answer is to look at Babelmark which shows literally every implementation has a different answer. Commonmark is probably the "most accurate" though, and they get around the multiples of 3 rule by excluding the final underscore as per Example #467. Markdown 1.1.1 is probably the second best out of that list though :).
UziTech commentedon Sep 4, 2020
I would like to get marked to follow common mark on all of these examples.
demo
_te_*st*<em>te</em><em>st</em>_te_**st**<em>te</em><strong>st</strong>_te__st_<em>te__st</em>_te___st__<em>te___st</em>_*te**st*<em>te**st</em>*te***st**<em>te</em><strong>st</strong>*te*_st_<em>te</em><em>st</em>*te*__st__<em>te</em><strong>st</strong>__te__*st*<strong>te</strong><em>st</em>__te__**st**<strong>te</strong><strong>st</strong>__te___st__<em>te___st</em>__te____st__<strong>te____st</strong>**te***st*<strong>te</strong><em>st</em>**te****st**<strong>te****st</strong>**te**_st_<strong>te</strong><em>st</em>**te**__st__<strong>te</strong><strong>st</strong>UziTech commentedon Sep 4, 2020
#1755 already passes all of the tests in #1754 (comment) but to pass the rest might require a change in the tokenizer.
github-actions commentedon Oct 21, 2020
🎉 This issue has been resolved in version 1.1.2 🎉
The release is available on:
Your semantic-release bot 📦🚀