GitBook
它基於Git
建立,並且直接考量技術文件編寫上的各種需求,像是所視即所得的Markdown
編輯器、也可以自動地將Markdown
轉換為ePub
、mobi
等電子書格式,甚至包辦了出版及販售電子書的相關平臺功能,越來越多開發者選擇在GitBook
撰寫技術文件,甚至其他領域的使用者也聞風而來,就連現任臺北市長之前在競選時,也運用GitBook
來發表市政白皮書。
安裝
shell> npm install -g gitbook-cli
shell> gitbook help
shell> mkdir mybook
shell> cd mybook
shell> gitbook init
shell> gitbook serve
Configuration
book.json
title
description
author
language
plugins
參考網站:
GitBook Editor
參考網站:
Plugins
book.json
{
"plugins": ["myPlugin", "anotherPlugin"]
}
{
"plugins": ["advanced-emoji"]
}
{
"plugins": ["youtube", "jsfiddle"]
"pluginsConfig": {
"jsfiddle": {
"type": "script",
"tabs": ["result", "js", "css", "html", "resources"],
"height": "500",
"width": "500",
"fontColor": "00FF00"
}
}
}
youtube
{% youtube %}https://www.youtube.com/watch?v=9bZkp7q19f0{% endyoutube %}
shell> gitbook install
jsfiddle
[source code](https://jsfiddle.net/4o4z6fqn/9/)
search-pro
{
"plugins": [
"-lunr", "-search", "search-pro"
]
}
emphasize
{
"plugins": ["emphasize"]
}
This text is highlighted !
This text is highlighted with markdown!
This text is highlighted in green!
This text is highlighted in red!
This text is highlighted with a custom color!
This text is {% em %}highlighted !{% endem %}
This text is {% em %}highlighted with **markdown**!{% endem %}
This text is {% em type="green" %}highlighted in green!{% endem %}
This text is {% em type="red" %}highlighted in red!{% endem %}
This text is {% em color="#ff0000" %}highlighted with a custom color!{% endem %}
splitter
{
"plugins": ["splitter"]
}
tbfed-pagefooter
{
"plugins": ["tbfed-pagefooter"],
"pluginsConfig": {
"tbfed-pagefooter": {
"type": "script",
"copyright": "© Taobao FED Team",
"modify_label": "該檔案修訂時間:",
"modify_format": "YYYY-MM-DD HH:mm:ss"
}
}
}
toggle-chapters
{
"plugins": ["toggle-chapters"]
}
plugin-fontsettings
{
"plugins": ["-fontsettings"]
}
{
"pluginsConfig": {
"fontsettings": {
"theme": 'white', // 'sepia', 'night' or 'white',
"family": 'sans', // 'serif' or 'sans',
"size": 1 // 1 - 4
}
}
}
cover.jpg
cover_small.jpg
參考網站:
- http://www.ithome.com.tw/voice/95002
- gitbook
- gitbook
- gitbook-cli
- markdown
- toolchain
- GitBook.gitignore
- plugins
- highlight.js
- advanced-emoji
- https://plugins.gitbook.com/plugin/jsfiddle
- https://plugins.gitbook.com/plugin/youtube
- https://plugins.gitbook.com/plugin/search-pro
- https://plugins.gitbook.com/plugin/emphasize
- https://plugins.gitbook.com/plugin/splitter
- https://plugins.gitbook.com/plugin/tbfed-pagefooter
- https://plugins.gitbook.com/plugin/toggle-chapters
- https://github.com/GitbookIO/plugin-fontsettings