├── book.json ├── README.md ├── SUMMARY.md ├── chapter-1/ | ├── README.md | ├── something.md ├── chapter-2/ | ├── README.md
文件名 | 描述 |
---|---|
book.json | 配置數據 (optional) |
README.md | 電子書的前言或簡介 (required) |
SUMMARY.md | 電子書目錄 (optional) |
GLOSSARY.md | 詞彙/註釋術語列表 (optional) |
變量 | 描述 |
---|---|
root | 包含全部圖書文件的根文件夾的路徑,除了 book.json |
structure | 指定自述文件,摘要,詞彙表等的路徑 |
title | 您的書名,默認值是從 README 中提取出來的。在 GitBook.com 上,這個字段是預填的。 |
description | 您的書籍的描述,默認值是從 README 中提取出來的。在 GitBook.com 上,這個字段是預填的。 |
author | 做者名。在GitBook.com上,這個字段是預填的。 |
isbn | 國際標準書號 ISBN |
language | 本書的語言類型 —— ISO code 。默認值是 en |
direction | 文本閱讀順序。能夠是 rtl (從右向左)或 ltr (從左向右),默認值依賴於 language 的值。 |
gitbook | 應該使用的GitBook版本,並接受相似於 >=3.0.0 的條件。 |
links | 在左側導航欄添加連接信息 |
plugins | 要加載的插件列表(官網插件列表) |
pluginsConfig | 插件的配置 |
highlight - 語法高亮插件
、search - 搜索插件
、sharing - 分享插件
、font-settings - 字體設置插件
、livereload - 熱加載插件
能夠在插件名稱前面加 -
css
"plugins": [ "-search" ]
Tips:添加插件後要進行安裝 gitbook install
html
變量 | 描述 |
---|---|
pdf.pageNumbers | 是否添加頁碼,默認是true |
pdf.fontSize | 字體大小,默認是12 |
pdf.fontFamily | 字體,默認字體是Arial |
pdf.paperSize | Paper size, options are a0 ,a1 ,a2 ,a3 ,a4 ,a5 ,a6 ,b0 ,b1 ,b2 ,b3 ,b4 ,b5 ,b6 ,legal ,letter (default is a4 ) |
pdf.margin.top | Top margin (default is 56) |
pdf.margin.bottom | Bottom margin (default is 56) |
pdf.margin.right | Right margin (default is 62) |
pdf.margin.left | Left margin (default is 62) |
--- 生成PDF文件 # gitbook pdf ./ ./mybook.pdf --- 生成ePub文件 # gitbook epub ./ ./mybook.epub --- 生成Mobi文件 # gitbook mobi ./ ./mybook.mobi
說明:把docx
、xml
、html
、odt
文檔轉成GitBook
# npm install gitbook-convert -g --- 若是須要作軟鏈 # ln -s /usr/local/node-v8.11.2-linux-x64/bin/gitbook-convert /usr/local/bin/gitbook-convert --- 如何使用 # gitbook-convert [options] <file> [export-directory]
mygitalk
基於gitalk的評論插件 ➡️ https://github.com/snowdreams1006/gitbook-plugin-mygitalk theme-default
GitBook的默認主題 ➡️ https://github.com/GitbookIO/theme-default autotheme
自動換膚插件 ➡️ https://github.com/willin/gitbook-plugin-autotheme sharing
默認的分享插件 ➡️ https://github.com/GitbookIO/plugin-sharing fontsettings
默認的字體、字號、顏色設置插件 ➡️ https://github.com/GitbookIO/plugin-fontsettings highlight
默認的代碼高亮插件,一般會使用 prism 來替換 ➡️ https://github.com/GitbookIO/plugin-highlight search
默認搜索插件 ➡️ https://github.com/GitbookIO/plugin-search search-plus
支持中文搜索插件 ➡️ https://github.com/lwdgit/gitbook-plugin-search-plus prism
基於 Prism 的代碼高亮 ➡️ https://github.com/gaearon/gitbook-plugin-prism favicon
更改網站的 favicon.ico ➡️ https://github.com/menduo/gitbook-plugin-favicon github
在右上角顯示 github 倉庫的圖標連接 ➡️ https://github.com/GitbookIO/plugin-github github-buttons
顯示 github 倉庫的star和fork按鈕 ➡️ https://github.com/azu/gitbook-plugin-github-buttons splitter
在左側目錄和右側內容之間添加一個能夠拖拽的欄,用來調整兩邊的寬度 ➡️ https://github.com/yoshidax/gitbook-plugin-splitter copy-code-button
爲代碼塊添加複製的按鈕 ➡️ https://github.com/WebEngage/gitbook-plugin-copy-code-button tbfed-pagefooter
自定義頁腳,顯示版權和最後修訂時間 ➡️ https://github.com/zhj3618/gitbook-plugin-tbfed-pagefooter expandable-chapters
收起或展開章節目錄中的父節點 ➡️ https://github.com/DomainDrivenArchitecture/gitbook-plugin-expandable-chapters expandable-chapters-small
比較好的摺疊側邊欄 ➡️ https://github.com/lookdczar/gitbook-plugin-expandable-chapters-small-auto book-summary-scroll-position-saver
自動保存左側目錄區域導航條的位置 ➡️ https://github.com/yoshidax/gitbook-plugin-book-summary-scroll-position-saver ga
添加 Google 統計代碼 ➡️ https://github.com/GitbookIO/plugin-ga sitemap
生成站點地圖 ➡️ https://github.com/GitbookIO/plugin-sitemap baidu
使用百度統計 ➡️ https://github.com/poppinlp/gitbook-plugin-baidu Donate
Gitbook 捐贈打賞插件 ➡️ https://github.com/willin/gitbook-plugin-donate anchors
標題帶有 github 樣式的錨點 ➡️ https://github.com/rlmv/gitbook-plugin-anchors anchor-navigation-ex
插件錨導航-EX ➡️ https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex theme-api
編寫 API 文檔 ➡️ https://github.com/GitbookIO/theme-api katex
使用KaTex進行數學排版 ➡️ https://github.com/GitbookIO/plugin-katex editlink
內容頂部顯示編輯本頁連接 ➡️ https://github.com/zhaoda/gitbook-plugin-editlink ad
在每一個頁面頂部和底部添加廣告或任何自定義內容 ➡️ https://github.com/zhaoda/gitbook-plugin-ad image-captions
抓取內容中圖片的alt
或title
屬性,在圖片下面顯示標題 ➡️ https://github.com/todvora/gitbook-plugin-image-captions chart
使用 C3.js 圖表 ➡️ https://github.com/csbun/gitbook-plugin-chart styles-sass
使用 SASS 替換 CSS ➡️ https://github.com/GitbookIO/plugin-styles-sass styles-less
使用 LESS 替換 CSS ➡️ https://github.com/GitbookIO/plugin-styles-less disqus
添加 disqus 評論插件 ➡️ https://github.com/GitbookIO/plugin-disqus latex-codecogs
使用數學方程式 ➡️ https://github.com/GitbookIO/plugin-latex-codecogs mermaid
使用流程圖 ➡️ https://github.com/JozoVilcek/gitbook-plugin-mermaid atoc
插入 TOC 目錄 ➡️ https://github.com/willin/gitbook-plugin-atoc ace
插入代碼高亮編輯器 ➡️ https://github.com/ymcatar/gitbook-plugin-ace sectionx
分離各個段落,並提供一個展開收起的按鈕 ➡️ https://github.com/ymcatar/gitbook-plugin-sectionx mcqx
交互式多選插件 ➡️ https://github.com/ymcatar/gitbook-plugin-mcqx include-codeblock
經過引用文件插入代碼 ➡️ https://github.com/azu/gitbook-plugin-include-codeblock fbqx
使用填空題 ➡️ https://github.com/Erwin-Chan/gitbook-plugin-fbqx spoiler
隱藏答案,當鼠標劃過期才顯示 ➡️ https://github.com/ymcatar/gitbook-plugin-spoiler anchor-navigation
錨點導航 ➡️ https://github.com/yaneryou/gitbook-plugin-anchor-navigation youtubex
插入 YouTube 視頻 ➡️ https://github.com/ymcatar/gitbook-plugin-youtubex redirect
重定向頁面跳轉 ➡️ https://github.com/ketan/gitbook-plugin-redirect duoshuo
使用多說評論 ➡️ https://github.com/codepiano/gitbook-plugin-duoshuo jsfiddle
插入 JSFiddle 組件 ➡️ https://github.com/Mavrin/gitbook-plugin-jsfiddle jsbin
插入 JSBin 組件 ➡️ https://github.com/jcouyang/gitbook-plugin-jsbin Advanced Emoji
支持emoji表情 ➡️ https://github.com/codeclou/gitbook-plugin-advanced-emoji Puml
使用 PlantUML 展現 uml 圖 ➡️ https://github.com/GitbookIO/plugin-puml Graph
使用 function-plot 繪製數學函數圖 ➡️ https://github.com/cjam/gitbook-plugin-graph Todo
添加 Todo 功能 ➡️ https://github.com/ly-tools/gitbook-plugin-todo include-csv
展現 csv 文件內容 ➡️ https://github.com/TakuroFukamizu/gitbook-plugin-include-csv musicxml
支持 musicxml 格式的曲譜渲染 ➡️ https://github.com/ymcatar/gitbook-plugin-musicxml versions-select
添加版本選擇的下拉菜單,針對文檔有多個版本的狀況 ➡️ https://github.com/prescottprue/gitbook-plugin-versions-select rss
添加 rss 訂閱功能 ➡️ https://github.com/denysdovhan/gitbook-plugin-rss multipart
將書籍分紅幾個部分 ➡️ https://github.com/citizenmatt/gitbook-plugin-multipart url-embed
嵌入動態內容 ➡️ https://github.com/basilvetas/gitbook-plugin-url-embed { "gitbook": "3.x.x", "plugins": ["favicon", "yahei", "github", "autotheme", "-lunr", "-search", "search-plus", "prism", "-highlight", "github-buttons", "splitter", "-sharing", "sharing-plus", "tbfed-pagefooter", "expandable-chapters-small", "book-summary-scroll-position-saver", "ga", "baidu", "donate", "anchors", "anchor-navigation-ex", "sitemap-general", "copy-code-button", "mygitalk", "multipart" ], "pluginsConfig": { "theme-default": { "showLevel": true }, "fontSettings": { "family": "serif", "size": 2 }, "github": { "url": "https://github.com/JoeyBling" }, "autotheme": { "white": [9, 10, 11, 12, 13, 14, 15, 16, 17], "sepia": [6, 7, 8, 18, 19], "night": [20, 21, 22, 23, 0, 1, 2, 3, 4, 5] }, "prism": { "css": [ "prismjs/themes/prism-tomorrow.css" ] }, "github-buttons": { "buttons": [{ "user": "JoeyBling", "repo": "myBook", "type": "star", "size": "small", "count": true }] }, "sharing": { "douban": false, "facebook": false, "google": true, "hatenaBookmark": false, "instapaper": false, "line": true, "linkedin": true, "messenger": false, "pocket": false, "qq": false, "qzone": true, "stumbleupon": false, "twitter": false, "viber": false, "vk": false, "weibo": true, "whatsapp": false, "all": [ "facebook", "google", "twitter", "weibo", "instapaper", "linkedin", "pocket", "stumbleupon" ] }, "tbfed-pagefooter": { "copyright": "Copyright © <a href='https://zhousiwei.gitee.io' target='_blank'>試毅-思偉</a> 2019", "modify_label": "修訂時間:", "modify_format": "YYYY-MM-DD HH:mm:ss" }, "ga": { "token": "UA-142790104-1" }, "baidu": { "token": "f1f256f18b7899e11647d6ec1f3ded2f" }, "donate": { "wechat": "/assets/weixin.png", "alipay": "/assets/alipay.jpeg", "title": "", "button": "賞", "alipayText": "支付寶打賞", "wechatText": "微信打賞" }, "anchor-navigation-ex": { "showLevel": true, "associatedWithSummary": false, "printLog": false, "multipleH1": true, "mode": "float", "showGoTop": true, "float": { "floatIcon": "fa fa-navicon", "showLevelIcon": false, "level1Icon": "fa fa-hand-o-right", "level2Icon": "fa fa-hand-o-right", "level3Icon": "fa fa-hand-o-right" }, "pageTop": { "showLevelIcon": false, "level1Icon": "fa fa-hand-o-right", "level2Icon": "fa fa-hand-o-right", "level3Icon": "fa fa-hand-o-right" } }, "sitemap-general": { "prefix": "https://zhousiwei.gitee.io/myBook/" }, "favicon": { "shortcut": "/assets/images/favicon.ico", "bookmark": "/assets/images/favicon.ico", "appleTouch": "/assets/images/apple-touch-icon.png", "appleTouchMore": { "120x120": "/assets/images/apple-touch-icon-120x120.png", "180x180": "/assets/images/apple-touch-icon-180x180.png" } }, "mygitalk": { "clientID": "608e351b48e4d0a3a528", "clientSecret": "***加密***", "repo": "myBook", "owner": "JoeyBling", "admin": ["JoeyBling"], "distractionFreeMode": false } }, "pdf": { "pageNumbers": true, "fontFamily": "Arial", "fontSize": 12, "paperSize": "a4", "margin": { "right": 62, "left": 62, "top": 56, "bottom": 56 } }, "title": "試毅-思偉_開源項目", "description": "試毅-思偉_開源項目", "author": "試毅-思偉", "language": "zh-hans", "root": ".", "structure": { "readme": "introduction.md" }, "links": { "sidebar": { "GitHub": "https://github.com/JoeyBling", "我的博客": "https://zhousiwei.gitee.io" } } }
Tips:添加插件後要進行安裝 gitbook install
node