Emoji for Jekyll

Emoji for Jekyll By Yihang Ho

I love the idea of having emojis in my articles. As I have mentioned several times earlier, this site is generated by Jekyll based on contents that I have written in Markdown. As far as I know, only a small amount of Markdown implementation support emoji, and the most famous implementation being GitHub Flavour Markdown. Therefore, I will definitely need some plugins to enable emoji for this site.

Previously, I found Jekyll Emoji which actually get the job done. However, there are two things that I don't like about it

  1. You have to load all the images for all the emojis on your server.
  2. The plugin act as a filter. That means you have to pass the emoji string to the filter manually using a Liquid tag.

What I have in mind is something that does its job automatically, with some fine-grain control when I need it. For example, I want the ability to disable emoji on certain posts by flipping a boolean value in the front matter, and the setup process should be very easy.

In the end, I decided to write my own plugin, and the best part is, its setup process is super easy. Basically, just copy a Ruby file and a JSON file over to the _plugins directory, and you are good to go.

The working principle of this plugin is that it scans all posts and pages for emoji strings, and then convert them into image tags that load the graphics from GitHub. As a result, you don't need to keep a copy of all the images. This plugin is designed as a generator, so there is no need to do any extra work to enable emoji. However, you also have the choice to disable emoji for certain posts and pages, and you can also choose to whitelist or blacklist certain emojis.

Take a look at its GitHub repository for more information. smiley