gitbook-comments
A project focusing on comments integrated with code management providers like GitLab or GitHub.
Installation
Add the following plugins to your book.json
and run the command gitbook install
{
"plugins": ["comments-footer"]
}
Usage
1. GitHub
To use this plugin in a GitBook project deployed on GitHub, the first step is to install the GitHub app in your repository for accessing.
And then, the configuration option can be set as an object like the following snippet:
{
"plugins": [
"comments-footer"
],
"pluginsConfig": {
"comments-footer": {
"type": "github",
"repo": "aleen42/PersonalWiki",
"copyright": "Copyright © aleen42"
}
}
}
2. GitLab
What if using it in GitLab? You may need to create an application yourself with API
scope accessing.
- Name: any name you want
- Redirect URI: the page url you published
-
Scopes: choose
api
And then, the configuration option can be set as an object like the following snippet:
{
"plugins": [
"comments-footer"
],
"pluginsConfig": {
"comments-footer": {
"type": "gitlab",
"repo": "fe-components/fe-documents",
"copyright": "Copyright © aleen42",
"redirect": "xxx",
"clientId": "xxx",
"host": "http://git.xxx.cn/"
}
}
}
- redirect: the page url you published
- clientId: the Application ID of your application created above
- host: the GitLab server host
TODO
- Disable subscribing states when commenting on articles.
-
Heroku is UNSTABLE for GitHub authorization!Migrated to deta.space - Replying features on GitLab.
-
GitLab features depend on the functions around commit comments: https://gitlab.com/gitlab-org/gitlab-ce/issues/59798.Use discussion instead. -
GitLab private access token has no detailed scope for avoiding abusing by others.It means that I cannot get discussions when users do not authorize themselves.
Release History
- ==================== 1.0.0 Initial release ====================
- 1.1.2 oauth2 integration
- 1.1.3 initial structure for featuring GitHub
- 1.1.4 fix bug
- 1.1.5 enhancement for reducing authorizing redirecting
- 1.1.6 enhancement of compatible styles
- 1.1.9 styles for the authorization wrapper and unexpected redirect url
- 1.2.0 support GitLab
- 1.2.2 fix commented time and passed parameters when leaving comments in GitLab
- 1.2.3 show user link anchor
- 1.2.5 bug fix and show site link after leaving comments
- 1.2.7 list all commits recursively
- 1.2.9 bug fix
- 1.3.0 more restrict regression for matching commit difference
- 1.3.1 support replying features in GitLab
- 1.3.2 redirect to visited site after authorized in GitLab
- 1.3.3 fix NPE problem
- 1.3.5 autocomplete feature within GitLab and fix a bug
- 1.3.7 unified font sizes
- 1.3.8 compatible autocomplete for GitHub
- 1.3.9 feature autocomplete for GitHub
- 1.4.2 deprecated token access way for GitHub
- 1.4.3 keep token in url queries for GitLab
- 1.4.5 audit vulnerable dependencies
- 1.4.7 avoid downloading font-awesome via using SimpleMDE
- 1.4.9 avoid exposing token via Heroku
- 1.5.2 use gitbook-color to support light or dark theme
- 1.5.7 fix some problems
- avoid empty token
- fix wrong z-index of book header
- base64 encode token to avoid detection of GitHub
- 1.6.0 migrate the server from Heroku to deta.space
Q&A
-
Why does requests towards GitLab API fails the policy of CORS? #4
I have tested under CE 11.7.5 and GitLab has already set
Access-Control-Allow-Origin: *
for all requests ofapi/*
under aGET
way by default. If not for your environment, try to find a way to configure it.
⛽ How to contribute
Have an idea? Found a bug? See how to contribute.
📜 License
MIT © aleen42
Note: if you like this project, feel free to buy me a swimming chance: