smile-parser

0.2.1 • Public • Published

Build Status

smile-parser

Greenkeeper badge 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.

Readme

Keywords

Package Sidebar

Install

npm i smile-parser

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

1.6 MB

Total Files

9

Last publish

Collaborators

  • jlumme