micromark / micromark-extension-gfm

micromark extension to support GFM (GitHub Flavored Markdown)
https://unifiedjs.com
MIT License
27 stars 2 forks source link

Should GitHub emoji be supported and converted to the appropriate Unicode character? :shipit: #10

Closed DavidAnson closed 1 year ago

DavidAnson commented 1 year ago

Initial checklist

Problem

While "EMOJICODE" is not covered by the GFM specification, it is specifically mentioned in their documentation: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#using-emoji.

Might it be reasonable to assume the the micromark GFM extension would include support for this syntax? Today, it seems the :emoji: is rendered to HTML as-is.

Solution

Convert :tada: to :tada:.

Alternatives

If a little competitive spirit is helpful, note that the markdown-it library has a plugin to do this: https://github.com/markdown-it/markdown-it-emoji.

ChristianMurphy commented 1 year ago

It is separate from GFM, but there is an existing plugin for it https://github.com/remarkjs/remark-gemoji

DavidAnson commented 1 year ago

Neat! That's seemingly a remark plugin - will it work as-is with micromark (which I'm using directly)?

ChristianMurphy commented 1 year ago

It is a remark plugin, there is not a micromark equivalent currently.

wooorm commented 1 year ago

Hi!

micromark deals with the markdown syntax. Tables are syntax for example. GH does not handle gemoji as syntax.

You can see that for example because escapes and character references don’t “work”.

:+1:
\:\-1:

:+1: \:-1:

Or you can see how it works inside HTML:

<p>:+1:</p>

:+1:

Doing gemoji requires knowledge of an HTML tree structure. We can’t do this work in micromark, it doesn’t have that.

We already have entire ecosystems for AST transforms: mdast/hast at the tree level, or remark/rehype/unified a little bit higher.

Closing as we can’t, and I believe shouldn’t, perform this here.

github-actions[bot] commented 1 year ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.