emojiguy

0.0.1-beta1 • Public • Published

🤷‍♂️ Emoji Guy

A NPM package to parse the emoji shortcodes for showing in HTML. Currently supporting the SLACK emojis, more on the way.

license npm latest package npm downloads github stars minified size last commit closed issues open issues

Installing

  • Using npm:
$ npm i emojiguy
  • Using yarn:
$ yarn add emojiguy

Usage

  1. Import the package
const emojiguy = require('emojiguy');
  1. Parse a text for HTML
const text = 'Hello everyone :man-raising-hand:. Good morning! :smile:';

const parsedText = emojiguy.parseForSlack(text, { separateTag: true });

console.log(parsedText);
// Hello everyone <span>&#x1F64B</span>. Good morning! <span>&#x1F604</span>

Methods

parseForSlack(text[, {separteTag}])

For replacing the emoji short codes with HTML codes. The returned text can be directly used in HTML document.

  • separteTag = false
const text = 'Hello everyone :man-raising-hand:. Good morning! :smile:';

let parsedText = emojiguy.parseForSlack(text);

console.log(parsedText);
// Hello everyone &#x1F64B. Good morning! &#x1F604
  • separteTag = true
const text = 'Hello everyone :man-raising-hand:. Good morning! :smile:';

let parsedText = emojiguy.parseForSlack(text, { separateTag: true });

console.log(parsedText);
// Hello everyone <span>&#x1F64B</span>. Good morning! <span>&#x1F604</span>

getHtmlCode(shortcode)

For getting the html code for a specific emoji short code.

console.log(emojiguy.getHtmlCode('low_battery'));
// &#x1FAAB

console.log(emojiguy.getHtmlCode(':low_battery:'));
// &#x1FAAB

Issues

If you encounter any issue while using the package please report it here 👉 Soumya-Dey/emoji-guy/Issues

License

MIT License

Package Sidebar

Install

npm i emojiguy

Weekly Downloads

0

Version

0.0.1-beta1

License

MIT

Unpacked Size

65.4 kB

Total Files

6

Last publish

Collaborators

  • soumyadey