22
33This is a plugin for automatically adding author and timestamp to each gitbook article, including creator and last modified user from git commits
44
5+ ## Usage
6+
7+ ### Recommended Environments
8+
9+ - Node.js 4.0+
10+ - npm 3.0+
11+ - gitbook 3.0+
12+
13+ ### install
14+
15+ ``` sh
16+ npm i -D gitbook-plugin-git-author
17+ ```
18+
19+ ### book.json
20+
21+ ``` js
22+ {
23+ " plugins" : [" git-author" ]
24+ " pluginsConfig" : {
25+ " git-author" : {
26+ " position" : " bottom" ,
27+ " modifyTpl" : " Last modified by {user} {timeStamp}" ,
28+ " createTpl" : " Created by {user} {timeStamp}" ,
29+ " timeStampFormat" : " YYYY-MM-DD HH:mm:ss"
30+ }
31+ }
32+ }
33+ ```
34+
535## Example
636
737` README.md ` file
838
9- Be sure to commit this file to git repository
39+ Be sure to commit this file to git repository firstly.
1040
1141``` markdown
1242# Title of the Article
@@ -21,43 +51,50 @@ content
2151
2252<p >content</p >
2353
24- <div class =" git-author-container" >
54+ <div class =" git-author-container git-author-bottom " >
2555 <div class =" modified" >Last modified by someone 2016-06-06 06:06:06</div >
2656 <div class =" created" >Created by someone 2016-06-06 06:06:06</div >
2757</div >
2858```
2959
30- ## Usage
60+ ## Options
3161
32- ### install
62+ ### ` position `
3363
34- ``` sh
35- npm i -D gitbook-plugin-git-author
36- ```
64+ default: ` bottom `
3765
38- ### book.json
66+ git-author content position in the article. ` top ` or ` bottom `
3967
40- ``` js
41- {
42- " plugins" : [" git-author" ]
43- " pluginsConfig" : {
44- " git-author" : {
45- " modifyTpl" : " Last modified by {user} {timeStamp}" ,
46- " createTpl" : " Created by {user} {timeStamp}" ,
47- " timeStampFormat" : " YYYY-MM-DD HH:mm:ss"
48- }
49- }
50- }
51- ```
68+ this will add a ` git-author-{position} ` className to ` git-author-container `
69+
70+ ### ` createTpl ` ` modifyTpl `
71+
72+ You can use ` {user} ` ` {timeStamp} ` as placeholder for username and timeStamp
73+
74+ default:
5275
53- ## hide creator
76+ createTpl: ` Created by {user} {timeStamp} `
77+ modifyTpl: ` Last modified by {user} {timeStamp} `
78+
79+ You may disable one of them by set it to a FALSY value.
80+
81+ e.g
5482
5583```
5684"createTpl": false
5785```
5886
87+ ### ` timeStampFormat `
88+
89+ default: ` YYYY-MM-DD HH:mm:ss `
90+
91+ use [ moment] ( https://www.npmjs.com/package/moment ) to process timeStamp
92+
93+
5994## custom styles
6095
96+ change default style by add a custom css file to your gitbook
97+
6198` book.json `
6299
63100``` js
@@ -74,6 +111,10 @@ npm i -D gitbook-plugin-git-author
74111.git-author-container {
75112 font-size: 85%;
76113}
114+
115+ .git-author-top {
116+ float: none;
117+ }
77118```
78119
79120
0 commit comments