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

21 lines
454 B
JavaScript
Raw Permalink 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) {
2020-05-17 02:46:05 +00:00
return `/_assets/svg/twemoji/${icon}.svg`
2020-03-16 02:34:42 +00:00
}
})
2019-01-18 20:58:39 +00:00
}
}
}