Respect requested text presentation of emojis
Current problem
Emojis can be rendered in two variants.
Text presentation | Emoji-style |
---|---|
😊︎ 😐︎ ☹︎ |
😊️ 😐️ ☹️ |
The variants defaults to the emoji-style one but the user can specify a variant by following the emoticon character by a Unicode “VARIATION SELECTOR”. There are two variation selectors (taken from Wikipedia):
- U+FE0E (VARIATION SELECTOR-15) selects text presentation
- U+FE0F (VARIATION SELECTOR-16) selects emoji-style
Read more about that in this Wikipedia article.
When you write an emoji and use the VARIATION SELECTOR-15, GitLab should show the text-style, however it currently renders both as a gl-emoji
.
Expected | Acutal |
---|---|
![]() |
![]() |
Solution
This MR makes tanuki_emoji
respect the variation selector and not detect emojis that are followed by U+FE0E (VARIATION SELECTOR-15). As a future iteration, tanuki_emoji
could perhaps detect the emoji but only when requested by the developer. This would require more work on GitLab though.
Related to gitlab-org/gitlab#219622
How to test
Once tanuki_emoji
is updated downstream in gitlab-org/gitlab
, you can test it like this:
- Go to an issue
- Edit the description
- Paste
🐶
- Press Enter twice
- Paste
🐶
- Open following page in a new tab: U+FE0E
- Click on Copy to Clipboard
- Switch the tab back to your issue
- Paste the copied character
- Save the description
- See that the emojis are rendered differently (first: emoji-style, second: text-style)