Skip to content

Commit

Permalink
fix: fix unicode emstrong (#2989)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Sep 16, 2023
1 parent 56cee0a commit 8ebbb3c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ export class _Tokenizer {
endReg.lastIndex = 0;

// Clip maskedSrc to same section of string as src (move to lexer?)
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
maskedSrc = maskedSrc.slice(-1 * src.length + match[0].length - 1);

while ((match = endReg.exec(maskedSrc)) != null) {
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
Expand Down
11 changes: 10 additions & 1 deletion test/specs/new/emoji_inline.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@
<p><strong>πŸ€“ test</strong></p>
<p><strong>πŸ–οΈ test</strong></p>
<p><strong>πŸ–οΈπŸ€“πŸ’ test</strong></p>
<p><strong>πŸ’ test</strong> test</p>
<p>test <strong>πŸ’ test</strong></p>
<p>test <strong>πŸ’ test</strong> test</p>
<p><em><strong>test πŸ’</strong></em></p>
<p><em><strong>πŸ’ test</strong></em></p>
<p><em><strong>πŸ’ test</strong></em> test</p>
<p>test <em><strong>πŸ’ test</strong></em></p>
<p>test <em><strong>πŸ’ test</strong></em> test</p>
<p><strong><strong>πŸ’ test</strong></strong></p>
<p>Situations where it works:</p>
<p>**πŸ’ **</p>
<p><strong>⚠️ test</strong></p>
<p>Here, the emoji rendering works, but the text doesn't get rendered in italic.</p>
<p><em>πŸ’ test</em></p>
<p><em>πŸ’ test</em></p>
20 changes: 19 additions & 1 deletion test/specs/new/emoji_inline.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ Situations where it fails:

**πŸ–οΈπŸ€“πŸ’ test**

**πŸ’ test** test

test **πŸ’ test**

test **πŸ’ test** test

***test πŸ’***

***πŸ’ test***

***πŸ’ test*** test

test ***πŸ’ test***

test ***πŸ’ test*** test

****πŸ’ test****

Situations where it works:

**πŸ’ **
Expand All @@ -18,4 +36,4 @@ Situations where it works:

Here, the emoji rendering works, but the text doesn't get rendered in italic.

*πŸ’ test*
*πŸ’ test*

1 comment on commit 8ebbb3c

@vercel
Copy link

@vercel vercel bot commented on 8ebbb3c Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marked-website – ./

marked-website-git-master-markedjs.vercel.app
markedjs.vercel.app
marked-website-markedjs.vercel.app
marked.js.org

Please sign in to comment.