title: Gitbook编写JSON文件 # 标题

date: 2020-10-31 16:34:30

updated: 2020-12-31

categories:

  • 前端

    tags:
  • JSON
  • Gitbook

Gitbook优化之编写JSON文件

  • Gitbook init后续优化

gitbook init命令是为了根据你提供的文件夹名字,在你的文件夹中生成一个README.md和SUMMARY.md文件

README.md文件,不能删除,是为你的电子书提供提纲

SUMMARY.md文件也不能删除,是你的电子书的目录

一、Gitbook后续插件

没有_book

在gitbook serve之后出现的是_book

二、安装插件

1、常用插件博客

2、如何给Gitbook换上好看的主题

  • 多级目录插件

在默认主题下面,安装一个插件,快速回到开头的一个插件

在我的GitBook项目根目录下编写book.json

{
"plugins" : [ "back-to-top-button" ]
}

然后

D:\___MyGitbook\DOS>gitbook install
info: installing 1 plugins using npm@3.9.2
info:
info: installing plugin "back-to-top-button"
info: install plugin "back-to-top-button" (*) from NPM with version 0.1.4
D:\___MyGitbook\DOS
`-- gitbook-plugin-back-to-top-button@0.1.4 info: >> plugin "back-to-top-button" installed with success

效果还不错。

三、JSON文件格式

{
"title": "DOS教程",
"author": "HACV",
"description": "选择学校",
"language": "zh-hans",
"gitbook": "3.2.3",
"links": {
"sidebar": {
"个人博客": "https://hacv.gitee.io/"
}
},
"plugins": [
"back-to-top-button",
"chapter-fold",
"github",
"insert-logo",
"tbfed-pagefooter",
"code",
"copy-code-button",
"flexible-alerts"
],
"pluginsConfig":
{
"github":
{
"url": "https://github.com/HACV"
},
"insert-logo":
{
"url": "https://portrait.gitee.com/uploads/avatars/user/2599/7799986_HACV_1603894099.png!avatar200",
"style": "background: none; max-height: 50px; min-height: 50px",
"title": "MaxWell教程"
},
"tbfed-pagefooter": {
"copyright":"Copyright &HACV 2020",
"modify_label": "该文件修订时间:",
"modify_format": "YYYY-MM-DD HH:mm:ss"
},
"code":
{
"copyButtons": false
}
} }

四、安装插件后serve

观察,它导入了loading plugin表示导入插件

D:\___MyGitbook\DOS>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 3.0s ! Starting server ...
Serving book on http://localhost:4000
(node:10216) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
^C终止批处理操作吗(Y/N)?
^C

五、用了NVM后收拾摊子

C:\Users\MaxWell\AppData\Roaming\npm\node_modules

C:\Users\MaxWell>hexo -v
'hexo' 不是内部或外部命令,也不是可运行的程序
或批处理文件。 C:\Users\MaxWell>where hexo
C:\Users\MaxWell\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo

发现hexo无法使用了,原先的博客也无法使用了,现在该如何进行进行处理?

C:\Users\MaxWell>npm install -g hexo-cli
C:\Program Files\nodejs\hexo -> C:\Program Files\nodejs\node_modules\hexo-cli\bin\hexo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\hexo-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + hexo-cli@4.2.0
added 63 packages from 324 contributors in 22.143s C:\Users\MaxWell>hexo -v
hexo-cli: 4.2.0
os: Windows_NT 10.0.16299 win32 x64
node: 12.16.3
v8: 7.8.279.23-node.35
uv: 1.34.2
zlib: 1.2.11
brotli: 1.0.7
ares: 1.16.0
modules: 72
nghttp2: 1.40.0
napi: 5
llhttp: 2.0.4
http_parser: 2.9.3
openssl: 1.1.1g
cldr: 36.0
icu: 65.1
tz: 2019c
unicode: 12.1 C:\Users\MaxWell>node -v
v12.16.3 C:\Users\MaxWell>npm -v
6.14.4 C:\Users\MaxWell>where hexo
C:\Users\MaxWell\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo
C:\Program Files\nodejs\hexo
C:\Program Files\nodejs\hexo.cmd

重新去测试

D:\___MySoftware\05.MyBlog\__Gitee\HACV>hexo clean && hexo g && hexo s
INFO Deleted database.
INFO Deleted public folder.

Gitbook参考的部分博客

gitbook 入门教程之主题插件

1、(最好的教程)目录初始化 · Gitbook使用入门

2、GitBook 使用教程

3、gitbook如何可以创建多级目录?

GitBook插件整理 - book.json配置 - 明月, - 博客园

主题 · GitBook 使用教程

最新文章

  1. 高仿一元云购IOS应用源码项目
  2. RESTful的理解
  3. jq鼠标隐藏显示的方法
  4. C语言 预处理一(文件包含--#include)
  5. 从网页上抓取Windows补丁信息然后整型输出(PowerShell)
  6. .Net程序员安卓学习之路2:访问网络API
  7. 解决:操作无法完成(错误0x00000709)。再次检查打印机名称,并确保打印机已连接到.
  8. mssql存储过程demo
  9. NHibernate多对多关联映射的实现
  10. word模版另存为网页(*.htm,*.html),转为jsp页面并加入数据后导出成word
  11. Javascript基础篇小结
  12. Endnote从头开始五:修改output style(转载)
  13. Android 手机应用开发经验 之 通过Socket(TCP/IP)与PC通讯
  14. HBase资料
  15. [ExtJS5学习笔记]第三十一节 sencha extjs 5使用cmd生成的工程部署到tomcat服务器
  16. springcloud 设置feign超时时间
  17. python相关的安装软件
  18. 使用SecureCRT脚本备份网络设备配置的一点感悟
  19. RFC-TCP
  20. Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test java.lang.IllegalStateException

热门文章

  1. 在Flask中构建API接口的相关概念
  2. 基于Apache Hudi 构建Serverless实时分析平台
  3. 通过URL地址将图片保存到本地
  4. 还不来了解ChatGPT?免费账号
  5. SRS视频流服务器初试
  6. 微信小程序数字转中文wxs
  7. dataset的基本使用
  8. 如何让别人pip install自己写的库?
  9. JZOJ 2022.02.10【提高组】模拟总结
  10. JZOJ 5351. 【NOIP2017提高A组模拟9.7】简单无向图