Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render :emojicode: as the corresponding emoji in markdown preview #21325

Open
1 task done
jansol opened this issue Nov 29, 2024 · 3 comments
Open
1 task done

Render :emojicode: as the corresponding emoji in markdown preview #21325

jansol opened this issue Nov 29, 2024 · 3 comments
Labels

Comments

@jansol
Copy link
Contributor

jansol commented Nov 29, 2024

Check for existing issues

  • Completed

Describe the feature

A number of projects on github use emojis in their README, often to keep feature support tables to a manageable size. Often they also use Github's :emojicode: syntax for them. It would be nice if Zed's markdown preview would render the :emojicode: syntax as the corresponding emoji.

The full list used by Github is available here: https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md
The majority is standard Unicode emoji, but there are a few Github-specific custom emoji as well -- I'm not sure if supporting those is worth the added complexity of fetching them from the Github API every time, and as they are Github-specific, they would likely cause confusion in projects hosted elsewhere.

Environment

N/A

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@JosephTLyons
Copy link
Collaborator

Seems reasonable to at least support the standard emoji codes here and gauge interest in the rest after.

@notpeter
Copy link
Member

notpeter commented Dec 3, 2024

Note, there Github's Emojicode syntax is distinct from the identically named Emojicode programming language.

There is a JSON of current Github emojicodes available here:
https://api.github.com/emojis

One could easily parse this:

{
  "+1": "https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png?v8",
  "-1": "https://github.githubassets.com/images/icons/emoji/unicode/1f44e.png?v8",
  "100": "https://github.githubassets.com/images/icons/emoji/unicode/1f4af.png?v8",
  "1234": "https://github.githubassets.com/images/icons/emoji/unicode/1f522.png?v8",

To extract the utf-8 values:

# curl -s https://api.github.com/emojis | sed -E 's|"(https://.*/)([^/]+)\.png.*"|"\2"|g' 
{
  "+1": "1f44d",
  "-1": "1f44e",
  "100": "1f4af",
  "1234": "1f522",

@notpeter
Copy link
Member

notpeter commented Dec 3, 2024

No need to reinvent the wheel.
There's actually an existing rust emojis crate which might be suitable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants