You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
454 B

  1. const mdEmoji = require('markdown-it-emoji')
  2. const twemoji = require('twemoji')
  3. // ------------------------------------
  4. // Markdown - Emoji
  5. // ------------------------------------
  6. module.exports = {
  7. init (md, conf) {
  8. md.use(mdEmoji)
  9. md.renderer.rules.emoji = (token, idx) => {
  10. return twemoji.parse(token[idx].content, {
  11. callback (icon, opts) {
  12. return `/_assets/svg/twemoji/${icon}.svg`
  13. }
  14. })
  15. }
  16. }
  17. }