csdn_spider/blog/ds19991999/原创-- ✍GitBook高级配置.md

255 lines
5.0 KiB
Markdown
Raw Permalink Normal View History

2021-02-27 15:01:45 +00:00
# 原创
✍GitBook高级配置
# ✍GitBook高级配置
>
先留链接防丢失:
- [gitbook-use](https://github.com/zhangjikai/gitbook-use/tree/master)- [使用GitBook打造自己的出版平台](https://blog.csdn.net/ds19991999/article/details/81275458)
2024-07-03 09:49:47 +00:00
### 安装?
2021-02-27 15:01:45 +00:00
2024-07-03 09:49:47 +00:00
### 常用命令?
2021-02-27 15:01:45 +00:00
>
- `gitbook-cli``gitbook` 是两个软件;- `gitbook-cli` 会将下载的 gitbook 的不同版本放到 `~/.gitbook`中, 可以通过设置`GITBOOK_DIR`环境变量来指定另外的文件夹.
2024-07-03 09:49:47 +00:00
### 目录结构?
2021-02-27 15:01:45 +00:00
```
.
├── book.json
├── README.md
├── SUMMARY.md
├── chapter-1/
| ├── README.md
| └── something.md
└── chapter-2/
├── README.md
└── something.md
```
2024-07-03 09:49:47 +00:00
#### Summary?
2021-02-27 15:01:45 +00:00
**示例1**以后会经常用到的
```
# Summary
* [Introduction](README.md)-------------------------------1.1
----
### [Part I](folder1/README.md)
* [Writing is nice](folder1/writing.md)-------------------2.1.
* [GitBook is nice](folder1/gitbook.md)-------------------2.2.
### Part II
* [We love feedback](folder2/feedback_please.md)----------3.1.
* [Better tools for authors](folder2/better_tools.md)-----3.2.
----
* [Last part without title](title.md)---------------------4.1.
```
**示例2**以后会用的但不常用的
```
# Summary
### Part I(part1/README.md)---------------------------1.
* [section1](part1/section1/README.md)----------------1.1.
* [Writing is nice](part1/section1/writing.md)----1.1.1
* [GitBook is nice](part1/section1/gitbook.md)----1.1.2
* [We love feedback](part1/title1.md)-----------------1.2
* [Better tools for authors](part1/title2.md)---------1.3
```
**示例3**:最简版本
```
# Summary
### Part I
* [Introduction](README.md)
* [Writing is nice](writing.md)
* [GitBook is nice](gitbook.md)
### Part II
* [We love feedback](feedback_please.md)
* [Better tools for authors](better_tools.md)
```
2024-07-03 09:49:47 +00:00
#### Glossary?
2021-02-27 15:01:45 +00:00
`GLOSSARY.md`。该文件主要存储词汇信息,如果在其他页面中出现了该文件中的词汇,鼠标放到词汇上会给出词汇示意。
`GLOSSARY.md` 格式:
```
## Git-----------------词汇
分散式版本控制软件--------词汇示意
## Markdown
Aaron Swartz 跟John Gruber共同设计的排版语言
```
2024-07-03 09:49:47 +00:00
### book.json?
2021-02-27 15:01:45 +00:00
`book.json` 最重要,故单独作为一节。
2024-07-03 09:49:47 +00:00
#### title设置书本的标题?
2021-02-27 15:01:45 +00:00
```
"title" : "Gitbook Use"
```
2024-07-03 09:49:47 +00:00
#### author作者的相关信息?
2021-02-27 15:01:45 +00:00
```
"author" : "ds"
```
2024-07-03 09:49:47 +00:00
#### description本书的简单描述?
2021-02-27 15:01:45 +00:00
```
"description" : "记录Gitbook的配置和一些插件的使用"
```
2024-07-03 09:49:47 +00:00
#### languageGitbook使用的语言?
2021-02-27 15:01:45 +00:00
版本2.6.4中可选的语言如下:
```
en, ar, bn, cs, de, en, es, fa, fi, fr, he, it, ja, ko, no, pl, pt, ro, ru, sv, uk, vi, zh-hans, zh-tw
```
配置使用简体中文:
```
"language" : "zh-hans",
```
2024-07-03 09:49:47 +00:00
#### gitbook: 指定使用的gitbook版本?
2021-02-27 15:01:45 +00:00
```
"gitbook" : "3.2.2",
"gitbook" : ">=3.0.0"
```
2024-07-03 09:49:47 +00:00
#### root指定根目录?
2021-02-27 15:01:45 +00:00
```
"root": "."
```
2024-07-03 09:49:47 +00:00
#### links左侧导航栏添加链接信息?
2021-02-27 15:01:45 +00:00
```
"links" : {
"sidebar" : {
"个人主页" : "http://www.ds-vip.top"
}
}
```
2024-07-03 09:49:47 +00:00
#### styles自定义页面样式?
2021-02-27 15:01:45 +00:00
默认情况下各`generator`对应的`css`文件:
```
"styles": {
"website": "styles/website.css",
"ebook": "styles/ebook.css",
"pdf": "styles/pdf.css",
"mobi": "styles/mobi.css",
"epub": "styles/epub.css"
}
```
例如使`<h1> <h2>`标签有下边框, 可以在`website.css`中设置,这个可以有。
```
h1 , h2{
border-bottom: 1px solid #EFEAEA;
}
```
2024-07-03 09:49:47 +00:00
#### plugins配置使用的插件?
2021-02-27 15:01:45 +00:00
```
"plugins": [
"disqus"
]
```
```
"plugins": [
"-search"
]
```
2024-07-03 09:49:47 +00:00
#### pluginsConfig配置插件的属性?
2021-02-27 15:01:45 +00:00
```
"pluginsConfig": {
"fontsettings": {
"theme": "sepia",
"family": "serif",
"size": 1
}
}
```
上面就是配置Gitbook界面那个`A`按钮的默认属性。
2024-07-03 09:49:47 +00:00
#### structure?
2021-02-27 15:01:45 +00:00
指定 Readme、Summary、Glossary 和 Languages 对应的文件名,下面是这几个文件对应变量以及默认值:
|变量|含义和默认值
|------
|`structure.readme`|`Readme file name (defaults to README.md)`
|`structure.summary`|`Summary file name (defaults to SUMMARY.md)`
|`structure.glossary`|`Glossary file name (defaults to GLOSSARY.md)`
|`structure.languages`|`Languages file name (defaults to LANGS.md)`
2024-07-03 09:49:47 +00:00
### GitBook插件?
2021-02-27 15:01:45 +00:00
可以指定插件的版本可以使用 `plugin@0.3.1` 下面的插件在 GitBook 的 `3.2.3` 版本中可以正常工作,[插件官网](https://plugins.gitbook.com/)。
具体介绍看这里:[https://github.com/zhangjikai/gitbook-use/blob/master/plugins.md](https://github.com/zhangjikai/gitbook-use/blob/master/plugins.md)
2024-07-03 09:49:47 +00:00
### 主题?
2021-02-27 15:01:45 +00:00
我们常用的就是 Book 文档模式,所以只看这部分。
2024-07-03 09:49:47 +00:00
#### theme-default?
2021-02-27 15:01:45 +00:00
默认的 Book 主题。将 `showLevel` 设为 `true` 就可以显示标题前面的数字索引,默认不显示。
```
{
"theme-default": {
"showLevel": true
}
}
```
2024-07-03 09:49:47 +00:00
#### theme-comscore?
2021-02-27 15:01:45 +00:00
这个主题为标题添加了颜色
```
{
"plugins": [
"theme-comscore"
]
}
```
2024-07-03 09:49:47 +00:00
### book.json配置文件?