21 lines
446 B
JavaScript
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`
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|