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
I found that back references (such as \1) perform strangely when they refer to groups ending with + or *. In fact \1 has chance to match any quantities of `.
For example, if (`+) matched `` and it was not closed, then \1 would match ` or ``` or ```` or ...
That's why /^(`+)([\s\S]*?[^`])\1(?!`)/ works well on `` ` `` but wrong on `` ` ```.
Then I added (?!`) after + to the first group, which seemed no sense. Actually it worked well, \1 will only match the same string that the group matches. You may test it to be sure.
I'm not very good at English, so I will try my best to explain if you don't understand what I want to say.
Activity
Feder1co5oave commentedon Feb 15, 2018
Thanks for reporting, this was partially my mistake in #1013.
Babelmark for reference.
The fix you suggest brings us back before #1013 so it is not right.
I have an easy partial fix for this which would produce the following output:
I'm adding this to the consolidating issue hoping that we'll conform with commonmark on codespans too.
icecola2018 commentedon Feb 15, 2018
Reply to @Feder1co5oave
I see the problem in #1030 .
Actually my suggestion
is different from the one before #1030
I found that back references (such as
\1) perform strangely when they refer to groups ending with+or*. In fact\1has chance to match any quantities of`.For example, if
(`+)matched``and it was not closed, then\1would match`or```or````or ...That's why
/^(`+)([\s\S]*?[^`])\1(?!`)/works well on`` ` ``but wrong on`` ` ```.Then I added
(?!`)after+to the first group, which seemed no sense. Actually it worked well,\1will only match the same string that the group matches. You may test it to be sure.I'm not very good at English, so I will try my best to explain if you don't understand what I want to say.
Feder1co5oave commentedon Feb 15, 2018
Thanks, you've been very clear and detailed, I'll look into this!
UziTech commentedon Dec 5, 2018
this seems to be fixed in the latest version of marked demo