MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

Support emojis in Markdown

Open updiversity opened this issue 3 years ago • 13 comments

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

updiversity avatar May 11 '22 07:05 updiversity

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:

welcome[bot] avatar May 11 '22 07:05 welcome[bot]

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

epogrebnyak avatar Aug 26 '22 12:08 epogrebnyak

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 avatar Oct 18 '22 18:10 adam-grant-hendry

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

adam-grant-hendry avatar Oct 18 '22 19:10 adam-grant-hendry

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

chrisjsewell avatar Mar 01 '23 07:03 chrisjsewell

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.

matrach avatar Jun 13 '23 15:06 matrach

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

chrisjsewell avatar Jun 13 '23 16:06 chrisjsewell

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 .

matrach avatar Jun 13 '23 20:06 matrach

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 👍

adam-grant-hendry avatar Jun 16 '23 23:06 adam-grant-hendry

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

chrisjsewell avatar Jul 11 '23 13:07 chrisjsewell

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.

dbitouze avatar Nov 13 '23 16:11 dbitouze

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:

  • Gnome (with default settings): tap Meta (aka 🪟 Windows key) and type the Unicode character name. Hitting Enter will copy it to the clipboard.
  • On Windows, press Windows + . (dot) for direct input.
  • On Mac, use Ctrl+Cmd+Space or Fn+E.

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 😉.

matrach avatar Dec 22 '23 21:12 matrach

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.

dbitouze avatar Dec 24 '23 16:12 dbitouze