DEMO
gh-emojiGithub emoji parsing done right 👍🙌👋👏💩🙋😈😄👶🙇👱🍔🍕👻💅👹🚲🚂
Gh-emoji aims to be the simplest Github emoji parser. It's built on the top of the Github Emoji Api with no dependencies and having a couple of functions as public api.
Installation
$ npm i gh-emoji
$ bower i gh-emoji
Usage
;
Demo
Take a look at the online demo
API
all
Return all fetched emojis.
Examples
; ;
Returns Object Object with emoji names as keys and generated image tags as values.
exist
Check if requested emoji exists.
Parameters
emojiId
String Name of emoji.
Examples
; ;
Returns Boolean
find
Return array with matched emojis in text.
Parameters
text
String Text to search for emojis.
Examples
; const text = 'Do you believe in :alien:...? :scream:'; ;
Returns Array.<String> Array with matched emojis.
getUrl
Return github's image url of emoji.
Parameters
emojiId
String Name of emoji.
Examples
; ;
Returns String Image url of given emoji.
load
Fetch the emoji data from Github's api.
Examples
; ;
Returns Promise.<Object> Promise which passes Object with emoji names as keys and generated image tags as values to callback.
parse
Parse text and replace emoji tags with actual emoji symbols.
Parameters
text
String Text to parse.options
Object Options with additional data for parser.options.classNames
String String with custom class names added to each emoji, separated with whitespace.
Examples
; const text = 'Do you believe in :alien:...? :scream:'; ;
Returns String Parsed text with emoji image tags in it.
References
- Github Emoji Api docs: https://developer.github.com/v3/emojis/
- Github Emoji Api: https://api.github.com/emojis
- All Github Emoji icons: https://github.com/scotch-io/All-Github-Emoji-Icons
Browser Support
Latest ✔ | Latest ✔ | IE 9+ ✔ | Latest ✔ | Latest ✔ |
License
MIT License © zzarcon