Emote

Small lib for converting emoticons and emoji names to emoji characters:

Works with emoji names:

iex> Emote.convert_text("my emoji game is :fire:")
"my emoji game is 🔥"

And emoticons (see lib/emoticons.txt for the list of supported ones):

iex> Emote.convert_text("my emoji game is :P")
"my emoji game is 😜"

You can also provide a list of images that can be used as custom emoji:

iex> Emote.convert_text("I can use images as custom emoji :favicon:", custom_emoji: %{"favicon" => "/favicon.ico"})
"I can use images as custom emoji <img class='emoji favicon' alt='favicon' title=':favicon:' src='/favicon.ico' />"

Or your own function to handle custom emoji:

> Emote.convert_text("I can define my own function to handle custom emoji :fire:",
custom_fn: fn word ->
case lookup_my_custom_emoji(word) do
%{label: label, url: url} ->
" <img alt='#{label || word}' title='#{label}' class='emoji' data-emoji='#{word}' src='#{url}' /> "
_nil_ ->
word
end
end
)

Known limitation:

License

WTFPL, as originally forked from https://github.com/danigulyas/smile