javascriptimport { marked } from 'marked'
import { markedEmoji } from 'marked-emoji'
import { Octokit } from '@octokit/rest'
const showMarkdown = () => {
let downDiv = document.getElementById('markdown-container')
while (downDiv === null) {
downDiv = document.getElementById('markdown-container')
}
emojiOptions().then((options) => {
// emoji配置
marked.use(markedEmoji(options))
// 转html
downDiv.innerHTML = marked.parse(pageStore.data, { emoji: true })
})
pageStore.loading = false
}
const emojiOptions = async () => {
const octokit = new Octokit()
// Get all the emojis available to use on GitHub.
const res = await octokit.rest.emojis.get()
const emojis = res.data
return {
emojis,
unicode: false
}
}
本文作者:DingDangDog
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!