Commit 9208e64 1 parent 4053491 commit 9208e64 Copy full SHA for 9208e64
File tree 3 files changed +41
-1
lines changed
3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ var plugins = [
49
49
{ name : 'front-matter' , entry : 'front-matter/index.js' } ,
50
50
{ name : 'zoom-image' , entry : 'zoom-image.js' } ,
51
51
{ name : 'codesponsor' , entry : 'codesponsor.js' } ,
52
- { name : 'disqus' , entry : 'disqus.js' }
52
+ { name : 'disqus' , entry : 'disqus.js' } ,
53
+ { name : 'gitalk' , entry : 'gitalk.js' }
53
54
]
54
55
55
56
plugins . forEach ( item => {
Original file line number Diff line number Diff line change @@ -161,3 +161,25 @@ Disqus comments. https://disqus.com/
161
161
</script >
162
162
<script src =" //unpkg.com/docsify/lib/plugins/disqus.min.js" ></script >
163
163
```
164
+
165
+ ## Gitalk
166
+
167
+ Gitalk is a modern comment component based on Github Issue and Preact. https://github.com/gitalk/gitalk
168
+
169
+ ``` html
170
+ <link rel =" stylesheet" href =" //unpkg.com/gitalk/dist/gitalk.css" >
171
+
172
+ <script src =" //unpkg.com/docsify/lib/plugins/gitalk.min.js" ></script >
173
+ <script src =" //unpkg.com/gitalk/dist/gitalk.min.js" ></script >
174
+ <script >
175
+ const gitalk = new Gitalk ({
176
+ clientID: ' Github Application Client ID' ,
177
+ clientSecret: ' Github Application Client Secret' ,
178
+ repo: ' Github repo' ,
179
+ owner: ' Github repo owner' ,
180
+ admin: [' Github repo collaborators, only these guys can initialize github issues' ],
181
+ // facebook-like distraction free mode
182
+ distractionFreeMode: false
183
+ })
184
+ </script >
185
+ ```
Original file line number Diff line number Diff line change
1
+ function install ( hook , vm ) {
2
+ const dom = Docsify . dom
3
+
4
+ hook . mounted ( _ => {
5
+ const div = dom . create ( 'div' )
6
+ div . id = 'gitalk-container'
7
+ const main = dom . getNode ( '#main' )
8
+ div . style = `width: ${ main . clientWidth } px; margin: 0 auto 20px;`
9
+ dom . appendTo ( dom . find ( '.content' ) , div )
10
+ const script = dom . create ( 'script' )
11
+ const content = `gitalk.render('gitalk-container')`
12
+ script . textContent = content
13
+ dom . appendTo ( dom . body , script )
14
+ } )
15
+ }
16
+
17
+ $docsify . plugins = [ ] . concat ( install , $docsify . plugins )
You can’t perform that action at this time.
0 commit comments