gitbook-plugin-icp
Advanced tools
Comparing version 0.0.7 to 0.1.0
{ | ||
"name": "gitbook-plugin-icp", | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"description": "gitbook plugin for adding icp info to footer", | ||
@@ -17,3 +17,2 @@ "main": "index.js", | ||
"website", | ||
"supervision", | ||
"supervision" | ||
@@ -20,0 +19,0 @@ ], |
111
README.md
@@ -13,4 +13,6 @@ # Welcome to gitbook-plugin-icp 👋 | ||
> Gitbook plugin add "edit this page" link, and intelligent recognition to `Github` or `Gitlab` source repository. | ||
> gitbook plugin for adding icp info to footer | ||
[English](./README.md) | [中文](./README_zh.md) | ||
### 🏠 [Homepage](https://github.com/snowdreams1006/gitbook-plugin-icp#readme) | ||
@@ -24,4 +26,10 @@ | ||
![icp-use-preview.png](icp-use-preview.png) | ||
- multilingual | ||
![icp-multilingual-index-use-preview.png](icp-multilingual-index-use-preview.png) | ||
- monolingual | ||
![icp-monolingual-index-use-preview.png](icp-monolingual-index-use-preview.png) | ||
## Usage | ||
@@ -32,5 +40,4 @@ | ||
1. In you gitbook's `book.json` file, add `icp` to `plugins` list. | ||
2. In `pluginsConfig`, Set `base` value which is base path to your github or gitlab or other code repo. Trailing slash is NOT required. | ||
3. By default link label will be "Edit This Page". You can change it using plugin config `label`. | ||
4. In `pluginsConfig`, Set `defaultBase` value which is set as default base path to your github or gitlab or other code repo. Trailing slash is also NOT required. | ||
2. In `pluginsConfig`,Set the `number` value to your own icp. | ||
3. In `pluginsConfig`,`label` or `link` value is NOT required.By default link url will be [http://www.beian.miit.gov.cn/](http://www.beian.miit.gov.cn/). | ||
@@ -44,3 +51,3 @@ Here is simplest example : | ||
"icp": { | ||
"base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book" | ||
"number": "浙ICP备18042346号" | ||
} | ||
@@ -54,23 +61,17 @@ } | ||
```json | ||
"base": { | ||
"type": [ | ||
"string", | ||
"object" | ||
], | ||
"title": "Base for the edit redirection", | ||
"label": { | ||
"type": "string", | ||
"title": "icp label", | ||
"required": false | ||
}, | ||
"number": { | ||
"type": "string", | ||
"title": "icp number", | ||
"required": true | ||
}, | ||
"defaultBase": { | ||
"link": { | ||
"type": "string", | ||
"title": "Default base for the edit redirection", | ||
"required": false | ||
}, | ||
"label": { | ||
"type": [ | ||
"string", | ||
"object" | ||
], | ||
"title": "Label for the edit button", | ||
"default": "Edit This Page", | ||
"required": false | ||
"title": "link url", | ||
"required": false, | ||
"default": "http://www.beian.miit.gov.cn/" | ||
} | ||
@@ -110,9 +111,3 @@ ``` | ||
"icp": { | ||
"base": { | ||
"snowdreams1006.github.io":"https://github.com/snowdreams1006/gitbook-plugin-icp/edit/master/docs", | ||
"snowdreams1006.gitlab.io":"https://gitlab.com/snowdreams1006/gitbook-plugin-icp/edit/master/docs", | ||
"snowdreams1006.gitee.io":"https://gitee.com/snowdreams1006/gitbook-plugin-icp/edit/master/docs" | ||
}, | ||
"defaultBase": "https://github.com/snowdreams1006/gitbook-plugin-icp/edit/master/docs", | ||
"label": "Edit This Page" | ||
"number": "浙ICP备18042346号" | ||
} | ||
@@ -132,3 +127,3 @@ } | ||
"icp": { | ||
"base": "https://github.com/snowdreams1006/gitbook-plugin-icp/edit/master/example" | ||
"number": "浙ICP备18042346号" | ||
} | ||
@@ -139,3 +134,3 @@ } | ||
### Sample `book.json` file | ||
- Sample `book.json` file | ||
@@ -147,3 +142,3 @@ ```json | ||
"icp": { | ||
"base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book" | ||
"number": "YOUR OWN ICP NUMBER" | ||
} | ||
@@ -161,4 +156,4 @@ } | ||
"icp": { | ||
"base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"label": "点我反馈" | ||
"label": "YOUR OWN ICP LABEL", | ||
"number": "YOUR OWN ICP NUMBER" | ||
} | ||
@@ -169,3 +164,3 @@ } | ||
### Sample `book.json` file for Multi-source base | ||
or you can add `link` to custom your link: | ||
@@ -177,10 +172,5 @@ ```json | ||
"icp": { | ||
"base": { | ||
"USER.github.io":"https://github.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"USER.gitlab.io":"https://gitlab.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"USER.gitee.io":"https://gitee.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"CUSTOME DOMAIN":"https://github.com/snowdreams1006/gitbook-plugin-icp/edit/master/docs" | ||
}, | ||
"defaultBase": "https://github.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"label": "Edit This Page" | ||
"label": "YOUR OWN ICP LABEL", | ||
"number": "YOUR OWN ICP NUMBER", | ||
"link":"YOUR OWN ICP LINK" | ||
} | ||
@@ -191,23 +181,4 @@ } | ||
### Sample `book.json` file for multilingual labels | ||
```json | ||
{ | ||
"plugins": ["icp"], | ||
"pluginsConfig": { | ||
"icp": { | ||
"base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"label": { | ||
"en": "Edit This Page", | ||
"zh": "编辑本页" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
**Note**: Above snippet can be used as complete `book.json` file, if your book doesn't have one yet. | ||
**Github/Gitlab**: In string `...REPO/edit/BRANCH...`, you may replace `edit` with `tree` if you want source file to open in read-mode, rather than edit-mode directly on github/gitlab. | ||
## Author | ||
@@ -233,12 +204,2 @@ | ||
This project is [MIT](https://github.com/snowdreams1006/gitbook-plugin-icp/blob/master/LICENSE) licensed. | ||
## Thanks | ||
- [gitbook-plugin-editlink](https://github.com/zhaoda/gitbook-plugin-editlink) | ||
- [gitbook-plugin-edit-link](https://github.com/rtCamp/gitbook-plugin-edit-link) | ||
## Troubleshooting | ||
1. If you are not seeing the "Edit this page" link, check if your `book.json` is valid. You can use this online tool - [http://json.parser.online.fr/beta/](http://json.parser.online.fr/beta/) | ||
2. Check if you are using default gitbook theme. It is NOT recommended to modify gitbook themes directly. | ||
This project is [MIT](https://github.com/snowdreams1006/gitbook-plugin-icp/blob/master/LICENSE) licensed. |
11
392033
191