Render unicode emoji with image fallback
See original GitHub issue(Moving discussion of rendering unicode emoji from #768 to a separate thread)
From #768:
According to caniemoji.com, unicode emoji are supported all the way back to Windows 7, macOS 10.7, Android 4.4, and iOS 5. Switching to unicode emoji would remove emoji
<img>
requests and render emoji native to each platform. Seems like a better route to go, so long as the unsupported OS+Browser combinations aren’t a concern. This article will likely be helpful if/when the switch to unicode happens.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
How to prevent Unicode characters from rendering as emoji in ...
Directly use a manually-maintained regex which matches the blocks where the newest version of Unicode puts its emoji and their modifiers.
Read more >Our journey in switching to native Unicode emoji - GitLab
The switch from image-based emoji to native Unicode wasn't a straightforward journey and included many intricacies to get production ready.
Read more >The struggle of using native emoji on the web
Emoji are a standard overseen by the Unicode Consortium. ... Your browser can render Emoji 13.1, released in September 2020.
Read more >UTS #51: Unicode Emoji
This document defines the structure of Unicode emoji characters and sequences, and provides data to support that structure, such as which characters are ......
Read more >Using Emojis in HTML, CSS, and JavaScript - KIRUPA
How you specify the codepoint is a bit different than what we saw for HTML. All you have to do is remove the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My initial thought was to just leverage the GitHub emoji API to get both the alias and the unicode value:
GitHub has already done the work of mapping aliases to unicode values and images (the file name is the unicode value), as well as adding logical duplicates like the example above.
As for the implementation:
Emoji data should be embedded in docsify.js, not requested from the GitHub API by the client.
GitHub data should be transformed to better fit docsify’s usage and reduce client-side parsing. For example, instead of embedding GitHub’s API data as-is:
The data should be transformed to allow fast unicode and URL lookups:
An automated task should be added that refreshes docsify’s local copy of GitHub API data, transforms the data as described above, and stores the result in a file that docsify can import/require at build time.
A test for emoji support will determine if a unicode character or image is rendered. I’d likely reference Modernizr’s emoji test and build from that. The test only needs to done one time, so the performance impact should be negligible.
Some minor CSS tweaks may be required for unicode emoji characters, and it will most likely make sense to wrap them in a
<span>
tag with a unique class.These non-breaking changes will provide the following benefits:
How does that sound?
Depends on how important you think this is. My preference would be to focus on getting the repo up-to-date (PRs, IE compatibility, triaging issues, etc.) for the next release (4.x) and push enhancements (like this) off to the following release.