diff --git a/src/rules.ts b/src/rules.ts index 0dd0f84770..d132f8706b 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -301,7 +301,7 @@ const inlineGfm: Record = { .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]*?(?:(?=[\\\

+

~\~

+

~

+

~\~~

+

~~ ~

+

~ ~~

diff --git a/test/specs/new/escape_within_del.md b/test/specs/new/escape_within_del.md new file mode 100644 index 0000000000..0421e75dad --- /dev/null +++ b/test/specs/new/escape_within_del.md @@ -0,0 +1,11 @@ +~\\~ + +~\\\~ + +~\~~ + +~\\~~ + +~\~ ~ + +~ \~~