fix: no strikethrough on different number of tildes (#1821)
Possible Breaking Change: When using the inline.del rule the text is provided in capture group 2 instead of 1.
This commit is contained in:
parent
73f10d3a9a
commit
d79f210aba
@ -585,7 +585,7 @@ module.exports = class Tokenizer {
|
|||||||
return {
|
return {
|
||||||
type: 'del',
|
type: 'del',
|
||||||
raw: cap[0],
|
raw: cap[0],
|
||||||
text: cap[1]
|
text: cap[2]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,8 +318,8 @@ inline.gfm = merge({}, inline.normal, {
|
|||||||
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
||||||
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
||||||
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
||||||
del: /^~+(?=\S)([\s\S]*?\S)~+/,
|
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
||||||
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
||||||
});
|
});
|
||||||
|
|
||||||
inline.gfm.url = edit(inline.gfm.url, 'i')
|
inline.gfm.url = edit(inline.gfm.url, 'i')
|
||||||
|
16
test/specs/new/del_strikethrough.html
Normal file
16
test/specs/new/del_strikethrough.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<p><del>test</del></p>
|
||||||
|
|
||||||
|
<p>~~test~</p>
|
||||||
|
|
||||||
|
<p>~test~~</p>
|
||||||
|
|
||||||
|
<p><del>test</del></p>
|
||||||
|
|
||||||
|
<p><del>test
|
||||||
|
test</del></p>
|
||||||
|
|
||||||
|
<p>~~test</p>
|
||||||
|
|
||||||
|
<p>test~~</p>
|
||||||
|
|
||||||
|
<pre><code class="language-test~~~"></code></pre>
|
16
test/specs/new/del_strikethrough.md
Normal file
16
test/specs/new/del_strikethrough.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
~~test~~
|
||||||
|
|
||||||
|
~~test~
|
||||||
|
|
||||||
|
~test~~
|
||||||
|
|
||||||
|
~test~
|
||||||
|
|
||||||
|
~~test
|
||||||
|
test~~
|
||||||
|
|
||||||
|
~~test
|
||||||
|
|
||||||
|
test~~
|
||||||
|
|
||||||
|
~~~test~~~
|
Loading…
x
Reference in New Issue
Block a user