fix: fix emstrong inside escaped backticks (#3652)
* fix: fix emstrong inside escaped backticks * add tests * lint
This commit is contained in:
parent
1ac6bc1f83
commit
721dc58ceb
@ -312,16 +312,17 @@ export class _Lexer {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Mask out other blocks
|
||||
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
||||
}
|
||||
|
||||
// Mask out escaped characters
|
||||
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
||||
}
|
||||
|
||||
// Mask out other blocks
|
||||
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
||||
}
|
||||
|
||||
let keepPrevChar = false;
|
||||
let prevChar = '';
|
||||
while (src) {
|
||||
|
9
test/specs/new/escape_tick.html
Normal file
9
test/specs/new/escape_tick.html
Normal file
@ -0,0 +1,9 @@
|
||||
<p><em>italics</em></p>
|
||||
<p><strong>bold</strong></p>
|
||||
<p><em><strong>bold italics</strong></em></p>
|
||||
<p><code>*quoted italics*</code></p>
|
||||
<p><code>**quoted bold**</code></p>
|
||||
<p><code>***quoted bold italics***</code></p>
|
||||
<p>`<em>escaped quoted italics</em>`</p>
|
||||
<p>`<strong>escaped quoted bold</strong>`</p>
|
||||
<p>`<em><strong>escaped quoted bold italics</strong></em>`</p>
|
17
test/specs/new/escape_tick.md
Normal file
17
test/specs/new/escape_tick.md
Normal file
@ -0,0 +1,17 @@
|
||||
*italics*
|
||||
|
||||
**bold**
|
||||
|
||||
***bold italics***
|
||||
|
||||
`*quoted italics*`
|
||||
|
||||
`**quoted bold**`
|
||||
|
||||
`***quoted bold italics***`
|
||||
|
||||
\`*escaped quoted italics*\`
|
||||
|
||||
\`**escaped quoted bold**\`
|
||||
|
||||
\`***escaped quoted bold italics***\`
|
Loading…
x
Reference in New Issue
Block a user