fix: fix del with escaped tilde (#3517)
* fix: fix del with escaped tilde * use rules to check for unescaped tilde * add tests with spaces
This commit is contained in:
parent
a612576ff6
commit
0afe87d7fb
@ -301,7 +301,7 @@ const inlineGfm: Record<InlineKeys, RegExp> = {
|
||||
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
|
||||
.getRegex(),
|
||||
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
||||
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
||||
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
||||
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/,
|
||||
};
|
||||
|
||||
|
6
test/specs/new/escape_within_del.html
Normal file
6
test/specs/new/escape_within_del.html
Normal file
@ -0,0 +1,6 @@
|
||||
<p><del>\</del></p>
|
||||
<p>~\~</p>
|
||||
<p><del>~</del></p>
|
||||
<p>~\~~</p>
|
||||
<p>~~ ~</p>
|
||||
<p>~ ~~</p>
|
11
test/specs/new/escape_within_del.md
Normal file
11
test/specs/new/escape_within_del.md
Normal file
@ -0,0 +1,11 @@
|
||||
~\\~
|
||||
|
||||
~\\\~
|
||||
|
||||
~\~~
|
||||
|
||||
~\\~~
|
||||
|
||||
~\~ ~
|
||||
|
||||
~ \~~
|
Loading…
x
Reference in New Issue
Block a user