Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,11 @@ export class _Lexer<ParserOutput = string, RendererOutput = string> {
}
}

// Mask out escaped characters
maskedSrc = maskedSrc.replace(this.tokenizer.rules.inline.anyPunctuation, '++');
// Mask out escaped characters.
// Every mask must keep the length it replaces: emStrong and del line
// maskedSrc up with src by slicing from the end. `anyPunctuation` matches
// unicode punctuation, so an escaped astral character is 3 code units.
maskedSrc = maskedSrc.replace(this.tokenizer.rules.inline.anyPunctuation, match0 => '+'.repeat(match0.length));

// Mask out other blocks
maskedSrc = maskedSrc.replace(this.tokenizer.rules.inline.blockSkip, (match0, _link, context) => {
Expand Down
7 changes: 7 additions & 0 deletions test/specs/new/em_escaped_astral_punctuation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<p><em>a</em>\πŸ™‚</p>
<p><em>a</em> \πŸ™‚ <em>b</em></p>
<p>x<em>ab</em>\πŸ™‚y</p>
<p><em>a</em>a\𐄀<em>b</em></p>
<p><strong>a</strong>\πŸ™‚b</p>
<p><del>a</del>\πŸ™‚</p>
<p><em>foo\πŸ™‚bar</em></p>
16 changes: 16 additions & 0 deletions test/specs/new/em_escaped_astral_punctuation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
gfm: true
---
*a*\πŸ™‚

*a* \πŸ™‚ *b*

x*ab*\πŸ™‚y

*a*a\𐄀*b*

__a__\πŸ™‚b

~~a~~\πŸ™‚

*foo\πŸ™‚bar*