wikijs-fork/server/modules/rendering/markdown-emoji/renderer.js

21 lines
446 B
JavaScript
Raw Normal View History

const mdEmoji = require('markdown-it-emoji')
2019-01-18 20:58:39 +00:00
const twemoji = require('twemoji')
// ------------------------------------
// Markdown - Emoji
// ------------------------------------
module.exports = {
init (md, conf) {
md.use(mdEmoji)
2019-01-18 20:58:39 +00:00
md.renderer.rules.emoji = (token, idx) => {
2020-03-16 02:34:42 +00:00
return twemoji.parse(token[idx].content, {
callback (icon, opts) {
return `/svg/twemoji/${icon}.svg`
}
})
2019-01-18 20:58:39 +00:00
}
}
}