Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop GitHub from rendering emojis in Markdown?

I'm trying to write "H:m:s" in some documentation, but GitHub keeps changing it to "HⓂ️s", since :m: is the code of the Ⓜ️ emoji.

How can I stop this behaviour?

like image 938
Ron Dunn Avatar asked Jun 02 '18 14:06

Ron Dunn


People also ask

Can you use Emojis in Markdown?

In most cases, you can simply copy an emoji from a source like Emojipedia and paste it into your document. Many Markdown applications will automatically display the emoji in the Markdown-formatted text. The HTML and PDF files you export from your Markdown application should display the emoji.

How do I add Emojis to GitHub Markdown?

GitHub uses emoji shortcodes for emoji insertion which replace the code with the native emoji character after entering. Eg: typing :heart_eyes: replaces this string with the 😍 Smiling Face With Heart-Eyes emoji.

How does GitHub render Markdown?

GitHub uses its own Markdown processor; GitHub Pages uses jekyll-commonmark. This means your README.md file will look different on GitHub's website than on your GitHub Pages website. For example, emoji are rendered on GitHub's website, but not on websites generated using GitHub Pages.


1 Answers

There are two ways to disable the rendering of an emoji:

  1. Use inline code with either ` or <code>, or use 4 spaces before the line to make the whole line monospaced.
  2. Insert a zero-width space after the first colon, like this:

    h:<zero-width space>m:s
    

You can copy a zero-width space from this Wikipedia article.

PS: for text (non-source context) you use the numeric entity representation, &#8203;
(the example results in "h:​m:s").

like image 119
Tamás Sengel Avatar answered Oct 27 '22 04:10

Tamás Sengel