feat: add gitalk plugin (#306)
This commit is contained in:
parent
405349102f
commit
9208e64939
3 changed files with 41 additions and 1 deletions
17
src/plugins/gitalk.js
Normal file
17
src/plugins/gitalk.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function install (hook, vm) {
|
||||
const dom = Docsify.dom
|
||||
|
||||
hook.mounted(_ => {
|
||||
const div = dom.create('div')
|
||||
div.id = 'gitalk-container'
|
||||
const main = dom.getNode('#main')
|
||||
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
|
||||
dom.appendTo(dom.find('.content'), div)
|
||||
const script = dom.create('script')
|
||||
const content = `gitalk.render('gitalk-container')`
|
||||
script.textContent = content
|
||||
dom.appendTo(dom.body, script)
|
||||
})
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins)
|
||||
Loading…
Add table
Add a link
Reference in a new issue