smile-parser
v0.2.1
Published
Emoji parser written in javascript
Downloads
8
Readme
smile-parser
This is a small library which takes a string, parses emojis out and replaces them with html image tags and returns the string.
Parses emojis from given string with syntax:
- :emoji:
- :emoji::skin-tone-2:
- :) :/ :( :'( :| ;) :D :P :o <-- These emojis require a start or end of string or space before or after to work, this is to avoid messing up url's for example
Supports only apple emojis hosted separately. Emoji-data comes from iamcal/emoji-data repository so huge thanks for him!
Usage
- Install and require the package
- Define options for the smile-parser
const emojiOpts = {
url: https://demo.url/emojis/,
styles: "height: 21px; position: relative;"
}
you need to host emojis somewhere and give the url to emoji folder in options
Run smileParse to a string you wish to parse
smileParse(string, emojiOpts)
Commands
- npm run test - Runs all the test
- npm run build - Compiles the code
- npm run compile-emoji minifies new emoji-data to include only necessary fields
Todo:
- Support sprites
- Create a demo page
- Support other emoji-libraries
- Finish this readme
License
MIT see LICENSE.md for details.