wikijs-fork/server/modules/rendering/markdown-emoji/renderer.js
2020-03-15 22:34:42 -04:00

21 lines
446 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 `/svg/twemoji/${icon}.svg`
}
})
}
}
}