在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):markdown-it/markdown-it-emoji开源软件地址(OpenSource Url):https://github.com/markdown-it/markdown-it-emoji开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):markdown-it-emoji
v1.+ requires Three versions:
Also supports emoticons shortcuts like Installnode.js, browser: npm install markdown-it-emoji --save
bower install markdown-it-emoji --save Useinitvar md = require('markdown-it')();
var emoji = require('markdown-it-emoji');
// Or for light version
// var emoji = require('markdown-it-emoji/light');
md.use(emoji [, options]); Options are not mandatory:
Differences in browser. If you load the script directly into the page without
using a package system, the module will add itself globally with the name var md = window.markdownit().use(window.markdownitEmoji); change outputBy default, emojis are rendered as appropriate unicode chars. But you can change the renderer function as you wish. Render as span blocks (for example, to use a custom iconic font): // ...
// initialize
md.renderer.rules.emoji = function(token, idx) {
return '<span class="emoji emoji_' + token[idx].markup + '"></span>';
}; Or use twemoji: // ...
// initialize
var twemoji = require('twemoji')
md.renderer.rules.emoji = function(token, idx) {
return twemoji.parse(token[idx].content);
}; NB 1. Read twemoji docs! In case you need more options to change image size & type. NB 2. When using twemoji you can make image height match the line height with this style: .emoji {
height: 1.2em;
} In your markdown fileHello from mars :satellite: becomes 全部评论
专题导读
上一篇:Tencent/cherry-markdown: ✨ A Markdown Editor发布时间:2022-08-18下一篇:naokazuterada/MarkdownTOC: SublimeText3 plugin which generate a table of content ...发布时间:2022-08-18热门推荐
热门话题
阅读排行榜
|
请发表评论