1. 安装nodejs10
下载安装nvm
https://github.com/coreybutler/nvm-windows/releases/download/1.1.9/nvm-setup.exe
安装配置nodejs
C:UsersAdministrator>nvm install 10
Downloading node.js version 10.24.1 (64-bit)...
Complete
Creating C:UsersAdministratorAppDataRoaming
vm emp
Downloading npm version 6.14.12... Complete
Installing npm v6.14.12...
Installation complete. If you want to use this version, type
nvm use 10.24.1
C:UsersAdministrator>nvm use 10.24.1
Now using node v10.24.1 (64-bit)
C:UsersAdministrator>npm config set registry https://registry.npm.taobao.org -g
C:UsersAdministrator>npm config get registry https://registry.npm.taobao.org/
https://registry.npm.taobao.org/
2. 安装gitbook
C:UsersAdministrator>npm install gitbook-cli -g
C:Program Files
odejsgitbook -> C:Program Files
odejs
ode_modulesgitbook-cliingitbook.js
+ gitbook-cli@2.3.2
added 578 packages from 672 contributors in 17.281s
C:UsersAdministrator>gitbook -V
CLI version: 2.3.2
Installing GitBook 3.2.3
...
GitBook version: 3.2.3
3. 配置gitbook
初始化
D:gitbook>gitbook init
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished
D:gitbook>gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 0.3s !
Starting server ...
Serving book on http://localhost:4000
目录结构
.
├── book.json
├── README.md
├── SUMMARY.md
├── chapter-1/
| ├── README.md
| └── something.md
└── chapter-2/
├── README.md
└── something.md
新建book.json
{
"plugins": [
"collapsible-menu",
"anchor-navigation-ex",
"tbfed-pagefooter",
"disqus",
"code",
"copy-code-button",
"expandable-chapters-small",
"-sharing",
"-lunr",
"-search",
"search-pro"
],
"title": "测试",
"language" : "zh-hans",
"pluginsConfig": {
"tbfed-pagefooter": {
"copyright":"Copyright © Amadeus 2024",
"modify_label": "文件修订时间:",
"modify_format": "YYYY-MM-DD HH:mm:ss"
},
"disqus": {
"shortName": "gitbookuse"
}
}
}
安装插件
D:gitbook>gitbook install
info: installing plugin "disqus"
runTopLevelLifecycles -> | |######################################################################################---|
D:gitbook
+-- gitbook-plugin-anchor-navigation-ex@1.0.14
+-- gitbook-plugin-collapsible-menu@1.0.3
+-- gitbook-plugin-disqus@0.1.0
`-- gitbook-plugin-tbfed-pagefooter@0.0.1
info: >> plugin "disqus" installed with success
D:gitbook>gitbook build
info: 11 plugins are installed
info: 10 explicitly listed
info: loading plugin "collapsible-menu"... OK
info: loading plugin "anchor-navigation-ex"... OK
info: loading plugin "tbfed-pagefooter"... OK
info: loading plugin "disqus"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
warn: "options" property is deprecated, use config.get(key) instead
info: >> generation finished with success in 0.4s !
D:gitbook>gitbook serve
设置目录
去除gitbook发布字样
在book的根目录里创建styles文件夹,然后在其中创建website.css文件
.gitbook-link {
display: none !important;
}
book.json
{
"styles": {
"website": "styles/website.css"
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...