Skip to content

Commit

Permalink
fix: include single nested parens in emStrong link mask (#3475)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored Oct 15, 2024
1 parent b1fd3ea commit 2b7efa8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/specs/new/underscore_link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p><em><a href="https://example.com?link=with_(underscore)">test</a></em></p>
1 change: 1 addition & 0 deletions test/specs/new/underscore_link.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_[test](https://example.com?link=with_(underscore))_

0 comments on commit 2b7efa8

Please sign in to comment.