Skip to content

Commit 2b7efa8

Browse files
authored
fix: include single nested parens in emStrong link mask (#3475)
1 parent b1fd3ea commit 2b7efa8

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/rules.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
175175
.replace(/punctuation/g, _punctuation).getRegex();
176176

177177
// sequences em should skip over [title](link), `code`, <html>
178-
const blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
178+
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
179179

180180
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u')
181181
.replace(/punct/g, _punctuation)

test/specs/new/underscore_link.html

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

test/specs/new/underscore_link.md

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

0 commit comments

Comments
 (0)