Emoji, gemoji, and emoticons in retext.
npm:
npm install retext-emoji
var retext = require('retext');
var emoji = require('retext-emoji');
var file = retext()
.use(emoji, {convert: 'encode'})
.processSync('I’m going to bed. :zzz:');
console.log(String(file));
Yields:
I’m going to bed. 💤
Emoji, gemoji, and emoticons in retext.
Optional configuration.
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:
).
retext-emoji
adds a new node to NLCST: Emoticon
(Symbol).
Whether emoji (❤️
), emoticon (<3
), or gemoji (:heart:
), all are
classified as EmoticonNode
s.
interface Emoticon < Symbol {
type: "EmoticonNode";
data: EmoticonData;
}
interface EmoticonData {
names: [string];
description: string | null;
tags: [string];
}