fix: include single nested parens in emStrong link mask (#3475)

This commit is contained in:
Tony Brix 2024-10-14 22:24:34 -06:00 committed by GitHub
parent b1fd3eafd8
commit 2b7efa8dda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

@ -175,7 +175,7 @@ const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
.replace(/punctuation/g, _punctuation).getRegex();
// sequences em should skip over [title](link), `code`, <html>
const blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u')
.replace(/punct/g, _punctuation)

View File

@ -0,0 +1 @@
<p><em><a href="https://example.com?link=with_(underscore)">test</a></em></p>

View File

@ -0,0 +1 @@
_[test](https://example.com?link=with_(underscore))_