Skip to content

fabricionaweb/emojis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo Emojis

build coverage dependencies devDependencies npm module

npm

This little package has a function (two actually) for replacing emoji codes (like :smiley:) for emoji images (or unicode characters) in a given string. Similar to GitHub and other websites.

Usage

$ npm install emojis
emojis@1.0.6 node_modules/emojis
$ node
> var emojis = require('emojis')
undefined
> emojis.replaceWithUnicode('I :heart: you!')
'I ❤️ you!'
> emojis.replaceWithHtml('I :heart: you!', 'http://example.org/images/')
'I <img class="emoji" width="20" height="20" src="http://example.org/images/heart.png" alt="heart"> you!'

Emoji codes and images

The emoji codes used are the ones on Emoji cheat sheet.

Their images are also provided here for you to use (images.zip), but consider their copyright.

Aligning the HTML image

One way to align the emoji image within the text would be using align="absmiddle", just as GitHub does, but I didn't do it because it's obsolete.

A suggestion is to use the following CSS:

.emoji {
  margin-bottom: .25em;
  vertical-align: middle;
}

About

replaces emoji codes to images

Resources

License

Stars

Watchers

Forks

Packages

No packages published