Skip to content

A NPM package to parse the emoji short codes for showing in HTML.

License

Notifications You must be signed in to change notification settings

Soumya-Dey/emoji-guy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🤷‍♂️ 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

About

A NPM package to parse the emoji short codes for showing in HTML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published