wikijs-fork/server/modules/rendering/markdown-emoji/renderer.js
2020-05-21 00:20:57 -04:00

21 lines
454 B
JavaScript

const mdEmoji = require('markdown-it-emoji')
const twemoji = require('twemoji')
// ------------------------------------
// Markdown - Emoji
// ------------------------------------
module.exports = {
init (md, conf) {
md.use(mdEmoji)
md.renderer.rules.emoji = (token, idx) => {
return twemoji.parse(token[idx].content, {
callback (icon, opts) {
return `/_assets/svg/twemoji/${icon}.svg`
}
})
}
}
}