Is it possible to render emojis as well? #107
-
I really love the tool but I ran in an inconvenience where Emojis where still rendered as text and not as graphics.
Is it possible to enable this somehow? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey, unicode emoji are supported in general, i. e. if you put in ⭐️ instead of It's possible to extend the // config.js
const marked = require('marked');
const { emojify } = require('node-emoji');
const renderer = new marked.Renderer();
renderer.text = emojify;
module.exports = {
// other options...
marked_options: { renderer },
};
You can refer to https://marked.js.org/using_pro to get more info about extending module.exports = {
marked_options: {
walkTokens: (token) => {
token.text = emojify(token.text);
// might also need
// token.tokens = this.Lexer.lexInline(token.text);
}
}
} TBH it would be nice to have a |
Beta Was this translation helpful? Give feedback.
Hey, unicode emoji are supported in general, i. e. if you put in ⭐️ instead of
:star:
, it should work. That double-colon syntax is not converted automatically though bymarked
(which is the underlying tool to convert the markdown to html)...It's possible to extend the
marked
renderer to do that; giving an example here but not claiming that it's robust in this way (feel free to figure out sth better), and I haven't tried running this, so not sure it actually works in this way.