-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix unicode Regex miscounting emoji length (#2942)
Many emojis are 2+ unicode bytes long. The \u tag which allows searching for punctuation also counts emojis as single chars. Slicing the strings into an array restores the correct character count.
- Loading branch information
1 parent
8fb1711
commit f3af23e
Showing
3 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<p>Situations where it fails:</p> | ||
<p><strong>test π</strong></p> | ||
<p><strong>π test</strong></p> | ||
<p><strong>π€ test</strong></p> | ||
<p><strong>ποΈ test</strong></p> | ||
<p><strong>ποΈπ€π test</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Situations where it fails: | ||
|
||
**test π** | ||
|
||
**π test** | ||
|
||
**π€ test** | ||
|
||
**ποΈ test** | ||
|
||
**ποΈπ€π test** | ||
|
||
Situations where it works: | ||
|
||
**π ** | ||
|
||
**β οΈ test** | ||
|
||
Here, the emoji rendering works, but the text doesn't get rendered in italic. | ||
|
||
*π test* |
f3af23e
There was a problem hiding this comment.
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 β ./
markedjs.vercel.app
marked-website-git-master-markedjs.vercel.app
marked-website-markedjs.vercel.app
marked.js.org