executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
759 stars 196 forks source link

Support emojis in Markdown #565

Open updiversity opened 2 years ago

updiversity commented 2 years ago

Context

I tried to use emoji in Markdown, like referred here

https://tutorialmarkdown.com/emojis

But when exported to html or confluence, it does not work.

It does just reproduce the text, like this one - :joy:

Proposal

it would be great if we could include them.

Tasks and updates

No response

welcome[bot] commented 2 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

epogrebnyak commented 2 years ago

I was looking for similar feature, but then realised an emoji is just a unicode character that you can add directrly to your source, without a shortcode:

You have to copy a character from somewhere, this can be a link above or https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md

adam-grant-hendry commented 2 years ago

I think it would be nicer to add support for the short codes. It's easier to know what's being displayed that way when reading the raw markdown, especially when reviewing the docs.

e.g.

Emoji Short Code Unicode
🎉 :tada: \u{1F389}

I know what ":tada:" is. I don't know what "\u{1F389}" is.

adam-grant-hendry commented 2 years ago

If support for adding 3rd-party/custom MarkdownIt plugins through conf.py were supported, the mdit-py-emoji plugin could be used.

chrisjsewell commented 1 year ago

Heya, is there a reason that you cannot just type emojis directly into the text? I have done this plenty in https://myst-parser.readthedocs.io/en/latest/ without issue

matrach commented 1 year ago

On of the use cases is to include in the docs a generated CHANGELOG.md file (e.g., by python-semantic-release) of a project using the shortcode format of gitmoji in commit messages.

chrisjsewell commented 1 year ago

using the shortcode format of gitmoji in commit messages.

but again, this page has a section on "Shortcode vs Unicode", and there is a lot more cons for using the shortcode 😅, plus unicode is supported on essentially every platform now

I know what ":tada:" is. I don't know what "\u{1F389}" is.

@adam-grant-hendry you don't need to use either of these, just directly use 🎉

It seems to me that shortcodes are a legacy syntax, from before unicode became a modern standard

matrach commented 1 year ago

It seems to me that shortcodes are a legacy syntax, from before unicode became a modern standard

Well, there are still people working on a :potato: that doesn't do emoji substitution in fonts :laughing:. For instance, my Tilix (based on gnome-terminal, with somewhat old Ubuntu Mono) does not yet understand that 👨[zero-with-joiner]💻 is 👨‍💻. Neither does IntelliJ (PyCharm) configured with Source Code Pro. xterms doesn't have any substitution at all and renders 👨‍💻 as .

adam-grant-hendry commented 1 year ago

Heya, is there a reason that you cannot just type emojis directly into the text? I have done this plenty in https://myst-parser.readthedocs.io/en/latest/ without issue

Typing in the emojis directly works for me 👍

chrisjsewell commented 1 year ago

FYI, essentially the pathway to allowing this in myst-parser, would be to create a plugin in https://github.com/executablebooks/mdit-py-plugins, to essentially port https://github.com/markdown-it/markdown-it-emoji. PRs welcome

Then we can add it in the list of enable_extensions

dbitouze commented 1 year ago

Heya, is there a reason that you cannot just type emojis directly into the text? I have done this plenty in https://myst-parser.readthedocs.io/en/latest/ without issue

One reason is that it can be tedious to have to open a web page/software/something where you know that such an emoji can be copied and pasted. For example, I opened Signal and typed :wink: to get, copy and paste 😉. Simply typing :wink: would be much more convenient.

matrach commented 11 months ago

For example, I opened Signal and typed :wink: to get, copy and paste 😉. Simply typing :wink: would be much more convenient.

FYI modern OSes have a direct way to input/search for Emoji. The quirk is, you may have to search with the Unicode name, not the short codes, which are non-standard. For instance:

This why I consider this feature to be more about supporting legacy hardware / software of the documentation's reader rather than usability of the writer 😉.

dbitouze commented 11 months ago

The quirk is, you may have to search with the Unicode name, not the short codes, which are non-standard.

Short codes, though non-standard, are easier to remember. E.g. :wink: vs U+1F609.