2018-01-15 03:05:08 +00:00
|
|
|
const mdEmoji = require('markdown-it-emoji')
|
2019-01-18 20:58:39 +00:00
|
|
|
const twemoji = require('twemoji')
|
2018-01-15 03:05:08 +00:00
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
// 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
|
|
|
}
|
2018-01-15 03:05:08 +00:00
|
|
|
}
|
|
|
|
}
|