mirror of
https://git.studyfor.work/actions/action-send-mail.git
synced 2026-04-29 07:40:14 -04:00
28 lines
654 B
JavaScript
28 lines
654 B
JavaScript
/**
|
|
* Turn emoji codes into emojis
|
|
*
|
|
* List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
|
|
*/
|
|
showdown.subParser('emoji', function (text, options, globals) {
|
|
'use strict';
|
|
|
|
if (!options.emoji) {
|
|
return text;
|
|
}
|
|
|
|
text = globals.converter._dispatch('emoji.before', text, options, globals);
|
|
|
|
var emojiRgx = /:([\S]+?):/g;
|
|
|
|
text = text.replace(emojiRgx, function (wm, emojiCode) {
|
|
if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
|
|
return showdown.helper.emojis[emojiCode];
|
|
}
|
|
return wm;
|
|
});
|
|
|
|
text = globals.converter._dispatch('emoji.after', text, options, globals);
|
|
|
|
return text;
|
|
});
|