Sphinx extension to use GitHub markdown emoji in Sphinx?

Did not find anything out there, so ended up creating an extension.

Install it with:

pip install sphinxemoji

Then, in your Sphinx's conf.py:

extensions = [
    '...',
    'sphinxemoji.sphinxemoji',
]

Then you can start using emoji codes in your documentation (note you need to use bars around the emoji code though):

This text includes a smily face |:smile:| and a snake too! |:snake:|

Don't you love it? |:heart_eyes:|

If you want consistent emoji style, you can add this to your conf.py:

sphinxemoji_style = 'twemoji'

You don't need to convert the emoji to a small image or use an extension, because Sphinx actually supports emoji as they're copy-pasted right out of the box.

If you copy any emoji and add it to a doc file, your editor might not show it correctly, but as long as the emoji was inserted it should show up in your doc.

Try it out with the siren emoji:

🚨

I know this works for reStructuredText files, so hopefully it should work for Markdown files too.

One thing to make this easier is to put substitutions for all the emoji you want to use in your rst_epilog for the reStructuredText files. This way you can use something like this in the epilog:

.. |siren| replace:: 🚨 

Every time you'd want to use a siren in your reStructuredText documents, you just use |siren|.