Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/L3au/gitbook-plugin-git-author
A gitbook plugin to show git author info
https://github.com/L3au/gitbook-plugin-git-author
git gitbook gitbook-plugin timestamp
Last synced: 2 months ago
JSON representation
A gitbook plugin to show git author info
- Host: GitHub
- URL: https://github.com/L3au/gitbook-plugin-git-author
- Owner: L3au
- Created: 2016-06-08T16:39:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T08:48:31.000Z (over 4 years ago)
- Last Synced: 2024-08-16T15:27:41.749Z (3 months ago)
- Topics: git, gitbook, gitbook-plugin, timestamp
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gitbook-plugin-git-author
- Size: 136 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gitbook-plugin-git-author
This is a plugin for automatically adding author and timestamp to each gitbook page, including creator and last-modified from git commits
[![npm](https://img.shields.io/npm/v/gitbook-plugin-git-author.svg)](https://www.npmjs.com/package/gitbook-plugin-git-author)
[![travis](https://img.shields.io/travis/L3au/gitbook-plugin-git-author.svg)](https://travis-ci.org/L3au/gitbook-plugin-git-author)
[![codecov](https://codecov.io/gh/L3au/gitbook-plugin-git-author/branch/master/graph/badge.svg)](https://codecov.io/gh/L3au/gitbook-plugin-git-author)
[![npm-downloads](https://img.shields.io/npm/dm/gitbook-plugin-git-author.svg)](https://www.npmjs.com/package/gitbook-plugin-git-author)![git-author-preview](https://raw.githubusercontent.com/L3au/gitbook-plugin-git-author/master/src/assets/preview.png)
## Usage
### Recommended Environments
- Node.js 4.0+
- npm 3.0+
- gitbook 3.0+### install
```sh
npm i -D gitbook-plugin-git-author
```### book.json
```js
{
"plugins": ["git-author"]
"pluginsConfig": {
"git-author":{
"position": "bottom",
"modifyTpl": "Last modified by {user} {timeStamp}",
"createTpl": "Created by {user} {timeStamp}",
"timeStampFormat": "YYYY-MM-DD HH:mm:ss"
}
}
}
```## Example
`README.md` file
Be sure to commit this file to git repository firstly.
```markdown
# Title of the Articlecontent
```### Output
```html
Title of the Article
content
```## Options
### `position`
default: `bottom`
git-author content position in the article. `top` or `bottom`
this will add a `git-author-{position}` className to `git-author-container`
### `createTpl` `modifyTpl`
You can use `{user}` `{timeStamp}` as placeholder for username and timeStamp
default:
createTpl: `Created by {user} {timeStamp}`
modifyTpl: `Last modified by {user} {timeStamp}`
You may disable one of them by set it to a FALSY value.
e.g
```
"createTpl": false
```### `timeStampFormat`
default: `YYYY-MM-DD HH:mm:ss`
use [moment](https://www.npmjs.com/package/moment) to process timeStamp
## Useful filters
You can use `timeFormat` nunjucks filter to format time string in each article.
### `timeFormat`([timeFormatString])
```
{{ 1466749374153 | timeFormat('YYYY-MM-DD') }}
```output
```
2016-06-24
``````
{{ '2016-06-24T07:27:04.365Z' | timeFormat('MMMM Do YYYY, h:mm:ss a') }}
```output
```
June 24th 2016, 3:27:04 pm
```## Custom styles
change default style by add a custom css file to your gitbook
`book.json`
```js
{
"styles": {
"website": "./styles/website.css"
}
}
````website.css`
```
.git-author-container {
font-size: 85%;
}.git-author-top {
float: none;
}
```