5.0.0 • Published 8 years ago
@luchanso/retext-emoji v5.0.0
retext-emoji

Emoji, gemoji, and emoticons in retext.
Installation
npm:
npm install retext-emojiUsage
var retext = require('retext');
var emoji = require('retext-emoji');
var file = retext()
.use(emoji, {convert: 'encode', useEmoticon: true})
.processSync('I’m going to bed. :zzz:');
console.log(String(file));Yields:
I’m going to bed. 💤API
retext().use(emoji[, options])
Emoji, gemoji, and emoticons in retext.
options
Optional configuration.
options.convert
How to convert ('encode' or 'decode', optional).
When encode, converts short-codes and emoticons to their unicode equivalent
(:heart: and <3 to ❤️).
When decode, converts unicode emoji and emoticons to their short-code
equivalent (❤️ and <3 to :heart:).
EmoticonNode
retext-emoji adds a new node to NLCST: Emoticon (Symbol).
Whether emoji (❤️), emoticon (<3), or gemoji (:heart:), all are
classified as EmoticonNodes.
interface Emoticon < Symbol {
type: "EmoticonNode";
data: EmoticonData;
}
interface EmoticonData {
names: [string];
description: string | null;
tags: [string];
}Support
retext-emoji supports every gemoji and every
emoticon.