国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

gitbook 快速入門

這篇具有很好參考價值的文章主要介紹了gitbook 快速入門。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

Gitbook 快速入門


1. 介紹

Gitbook 是一款優(yōu)秀的 基于 Node.js 的開源文檔管理工具,具有豐富的開源插件。

GitBook 支持 Markdown 和 AsciiDoc 兩種語法格式,能夠輸出 html,pdf,epub,mobi 等多種格式。

2. 條件

nodejs 安裝 node一定要安裝10.X版本,否則報如下錯誤:

CLI version: 2.3.2
Installing GitBook 3.2.3
/usr/local/node/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287
      if (cb) cb.apply(this, arguments)
                 ^

TypeError: cb.apply is not a function
    at /usr/local/node/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqCallback.oncomplete (fs.js:193:5)

系統(tǒng):ubuntu:18.04

3. gitbook 安裝

$ npm install gitbook-cli -g
/usr/local/node/bin/gitbook -> /usr/local/node/lib/node_modules/gitbook-cli/bin/gitbook.js
+ gitbook-cli@2.3.2
added 578 packages from 672 contributors in 191.662s

#找到gitbook命令位置
$ ls /usr/local/node-v10.24.0-linux-x64/bin/
gitbook            node               node_modules/      npm                npx                package-lock.json

#添加軟連接
$ ln -s /usr/local/node-v10.24.0-linux-x64/bin/gitbook /usr/local/bin/

$ ln -s /usr/local/node-v10.24.0-linux-x64/bin/book /usr/local/bin/

$ gitbook -V
CLI version: 2.3.2
Installing GitBook 3.2.3
gitbook@3.2.3 ../../../../tmp/tmp-117466TKiRhUq3ov0O/node_modules/gitbook
├── escape-html@1.0.3
├── escape-string-regexp@1.0.5
├── destroy@1.0.4
├── ignore@3.1.2
├── bash-color@0.0.4
├── gitbook-plugin-livereload@0.0.1
├── cp@0.2.0
├── nunjucks-do@1.0.0
├── graceful-fs@4.1.4
├── github-slugid@1.0.1
├── direction@0.1.5
├── q@1.4.1
├── spawn-cmd@0.0.2
├── gitbook-plugin-fontsettings@2.0.0
├── open@0.0.5
├── is@3.3.0
├── object-path@0.9.2
├── extend@3.0.2
├── json-schema-defaults@0.1.1
├── gitbook-plugin-search@2.2.1
├── jsonschema@1.1.0
├── crc@3.4.0
├── urijs@1.18.0
├── semver@5.1.0
├── immutable@3.8.2
├── front-matter@2.3.0
├── npmi@2.0.1 (semver@4.3.6)
├── resolve@1.1.7
├── gitbook-plugin-theme-default@1.0.7
├── moment@2.13.0
├── npm@3.9.2
├── dom-serializer@0.1.0 (domelementtype@1.1.3, entities@1.1.2)
├── tmp@0.0.28 (os-tmpdir@1.0.2)
├── error@7.0.2 (xtend@4.0.2, string-template@0.2.1)
├── omit-keys@0.1.0 (isobject@0.2.0, array-difference@0.0.1)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── js-yaml@3.14.1 (esprima@4.0.1, argparse@1.0.10)
├── gitbook-plugin-lunr@1.2.0 (html-entities@1.2.0, lunr@0.5.12)
├── gitbook-plugin-highlight@2.0.2 (highlight.js@9.2.0)
├── gitbook-plugin-sharing@1.0.2 (lodash@3.10.1)
├── i18n-t@1.0.1 (lodash@4.17.21)
├── gitbook-markdown@1.3.2 (kramed-text-renderer@0.2.1, gitbook-html@1.3.3, kramed@0.5.6, lodash@4.17.21)
├── gitbook-asciidoc@1.2.2 (gitbook-html@1.3.3, asciidoctor.js@1.5.5-1, lodash@4.17.21)
├── send@0.13.2 (fresh@0.3.0, etag@1.7.0, statuses@1.2.1, range-parser@1.0.3, ms@0.7.1, depd@1.1.2, mime@1.3.4, debug@2.2.0, http-errors@1.3.1, on-finished@2.3.0)
├── fresh-require@1.0.3 (is-require@0.0.1, shallow-copy@0.0.1, astw@1.3.0, acorn@0.9.0, sleuth@0.1.1, escodegen@1.14.3, through2@0.6.5)
├── rmdir@1.2.0 (node.flow@1.2.3)
├── request@2.72.0 (tunnel-agent@0.4.3, aws-sign2@0.6.0, forever-agent@0.6.1, oauth-sign@0.8.2, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.6, aws4@1.11.0, isstream@0.1.2, json-stringify-safe@5.0.1, tough-cookie@2.2.2, node-uuid@1.4.8, qs@6.1.2, hawk@3.1.3, combined-stream@1.0.8, mime-types@2.1.34, http-signature@1.1.1, form-data@1.0.1, bl@1.1.2, har-validator@2.0.6)
├── read-installed@4.0.3 (debuglog@1.0.1, util-extend@1.0.3, slide@1.1.6, readdir-scoped-modules@1.1.0, read-package-json@2.1.2)
├── cpr@1.1.1 (rimraf@2.4.5)
├── tiny-lr@0.2.1 (parseurl@1.3.3, livereload-js@2.4.0, qs@5.1.0, debug@2.2.0, faye-websocket@0.10.0, body-parser@1.14.2)
├── cheerio@0.20.0 (entities@1.1.2, lodash@4.17.21, css-select@1.2.0, htmlparser2@3.8.3, jsdom@7.2.2)
├── juice@2.0.0 (deep-extend@0.4.2, slick@1.12.2, batch@0.5.3, cssom@0.3.1, cross-spawn-async@2.2.5, commander@2.9.0, web-resource-inliner@2.0.0)
├── chokidar@1.5.0 (async-each@1.0.3, path-is-absolute@1.0.1, inherits@2.0.4, glob-parent@2.0.0, is-glob@2.0.1, is-binary-path@1.0.1, anymatch@1.3.2, readdirp@2.2.1)
└── nunjucks@2.5.2 (asap@2.0.6, yargs@3.32.0, chokidar@1.7.0)
GitBook version: 3.2.3

4. gitbook 創(chuàng)建

$ mkdir gitbook-demo
$ cd gitbook-demo

#使用 gitbook init 初始化書籍目錄
$ gitbook init 
warn: no summary file in this book 
info: create README.md 
info: create SUMMARY.md 
info: initialization is finished 

$ ls 
README.md  SUMMARY.md
#使用 gitbook build 編譯書籍
$ gitbook build
info: 7 plugins are installed 
info: 6 explicitly listed 
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.4s ! 


$ ls
_book  README.md  SUMMARY.md

$ ls _book/
gitbook  index.html  search_index.json

$ ls _book/gitbook/
fonts  gitbook.js  gitbook-plugin-fontsettings  gitbook-plugin-highlight  gitbook-plugin-lunr  gitbook-plugin-search  gitbook-plugin-sharing  images  style.css  theme.js

#使用 gitbook serve 編譯并預(yù)覽書籍
$ 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.5s ! 

Starting server ...
Serving book on http://localhost:4000

效果
gitbook 快速入門
圖中側(cè)欄Introduction的內(nèi)容正是README.md的內(nèi)容,SUMMARY.md 是編寫界面?zhèn)葯诘哪夸浗Y(jié)構(gòu)。

$ cat README.md 
# Introduction

$ cat SUMMARY.md 
# Summary

* [Introduction](README.md)

5. SUMMARY.md

GitBook 使用文件 SUMMARY.md 來定義書本的章節(jié)和子章節(jié)的結(jié)構(gòu)。文件 SUMMARY.md 被用來生成書本內(nèi)容的預(yù)覽表。
SUMMARY.md 的格式是一個簡單的鏈接列表,鏈接的名字是章節(jié)的名字,鏈接的指向是章節(jié)文件的路徑。子章節(jié)被簡單的定義為一個內(nèi)嵌于父章節(jié)的列表。以 # 開頭的行為注釋被忽略。
GitBook使用一個SUMMARY.md文件來定義文檔的菜單。
雖說在官方文檔中,它是可選的,但是它相當重要,控制了左邊菜單欄的顯示內(nèi)容。它通過 Markdown 中的列表語法來表示文件的父子關(guān)系。緊湊型的。

創(chuàng)建一個目錄,并編寫一個markdown格式的文檔

$ mkdir git
$ mv git_training.md git
$ ls
_book  book.json  book.json_bak  git  kubernetes  node_modules  README.md  SUMMARY.md
$ ls git/
1_git_introduce.md  2_git_command.md

編寫SUMMARY.md

# Summary
  
## 前言

* [Introduction](README.md)

## git

* [git 介紹](git/1_git_introduce.md)
  * [git 命令](git/2_git_training.md)

啟動

$ gitbook serve

效果:
gitbook 快速入門
當 md 文件數(shù)量非常多時,我們可以利用 插件 summary 自動生成菜單 summary 文件的介紹。

6. README.md

書本的首頁內(nèi)容默認是從文件 README.md 中提取的。

README.md是 gitbook 最基礎(chǔ)的文件之一,它一般用來描述這本書最基本的信息。 它呈現(xiàn)給讀者這本書最初的樣子,如果內(nèi)容不夠簡潔明了,很可能就沒有看下去的欲望了。

可以通過 gitbook init 自動創(chuàng)建該文件。

如果這個文件名沒有出現(xiàn)在 SUMMARY.md (目錄索引文件) 中,那么它會被添加為章節(jié)的第一個條目。

如何替代README.md

一些項目更愿意將 README.md 文件作為項目的介紹而不是書的介紹。

大部分代碼托管平臺將 README.md 自動顯示到項目首頁,如果你不喜歡這樣。 從GitBook >2.0.0 起,就可以在 book.json 中定義某個文件作為README

刪除掉SUMMARY.md文檔關(guān)于README.md的引用
編寫information.md

$ cat information.md 
---
這是一本關(guān)于介紹git、github、gitlab、gitbook的書籍。

比起官方的理解,它更接近體驗訓(xùn)練。

book.json添加structure參數(shù)

book.json
{
    "structure" : {
        "readme" : "information.md"
    }
}

啟動

$ gitbook serve

效果:默認的首頁
gitbook 快速入門

7. book.json

7.1 側(cè)欄添加鏈接

$ ls
_book  book.json  kubernetes  README.md  SUMMARY.md

$ vim book.json
{
    "author": "zongxun <me@zongxun.cn>",
    "description": "This is a sample book created by gitbook",
    "extension": null,
    "generator": "site",
    "links": {
        "sharing": {
            "all": null,
            "facebook": null,
            "google": null,
            "twitter": null,
            "weibo": null
        },
        "sidebar": {
            "Blog": "https://blog.csdn.net/xixihahalelehehe?spm=1000.2115.3001.5343"
        }
    },
    "output": null,
    "pdf": {
        "fontSize": 12,
        "footerTemplate": null,
        "headerTemplate": null,
        "margin": {
            "bottom": 36,
            "left": 62,
            "right": 62,
            "top": 36
        },
        "pageNumbers": false,
        "paperSize": "a4"
    },
    "plugins": [],
    "title": "GitBook Handbook",
    "variables": {}
}

$ 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.5s ! 

Starting server ...
Serving book on http://localhost:4000

效果,只看到了一個Blog鏈接。
gitbook 快速入門

7.2 添加一個插件

編寫book.json添加新theme-comscore顏色插件

$ cat book.json
{
    "author": "zongxun <me@zongxun.cn>",
    "description": "This is a sample book created by gitbook",
    "extension": null,
    "generator": "site",
    "links": {
        "sharing": {
            "all": null,
            "facebook": null,
            "google": null,
            "twitter": null,
            "weibo": null
        },
        "sidebar": {
            "Blog": "https://blog.csdn.net/xixihahalelehehe?spm=1000.2115.3001.5343"
        }
    },
    "output": null,
    "pdf": {
        "fontSize": 12,
        "footerTemplate": null,
        "headerTemplate": null,
        "margin": {
            "bottom": 36,
            "left": 62,
            "right": 62,
            "top": 36
        },
        "pageNumbers": false,
        "paperSize": "a4"
    },
    "plugins": [
     "theme-comscore" 
    ],
    "title": "GitBook Handbook",
    "variables": {}
}

安裝插件

gitbook install
info: installing 1 plugins using npm@3.9.2 
info:  
info: installing plugin "theme-comscore" 
info: install plugin "theme-comscore" (*) from NPM with version 0.0.3 
/root/github/gitbook-demo
└── gitbook-plugin-theme-comscore@0.0.3 

info: >> plugin "theme-comscore" installed with success 
 

執(zhí)行

$  gitbook serve

添加主題插件前:
gitbook 快速入門
添加主題插件后:
gitbook 快速入門文章來源地址http://www.zghlxwxcb.cn/news/detail-468905.html

到了這里,關(guān)于gitbook 快速入門的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 用GitBook制作自己的網(wǎng)頁版電子書

    用GitBook制作自己的網(wǎng)頁版電子書

    前言 幾年前閱讀過其他人用GitBook創(chuàng)建的文檔,可以直接在瀏覽器中打開,頁面干凈整潔,非常清爽,至今印象深刻。 GitBook非常適合用來為個人或團隊制作文檔,對于我這種偶爾寫博客的人群來說,GitBook可以說是一款神器。我后續(xù)打算用GitBook來整理一些可以歸納到一個系列

    2024年02月04日
    瀏覽(21)
  • windows服務(wù)器實用(6)——gitbook安裝與部署

    windows服務(wù)器實用(6)——gitbook安裝與部署

    為了查找方便,以下內(nèi)容來自GPT GitBook是一個基于Git的文檔編寫和托管平臺,它提供了一種方便易用的方式來創(chuàng)建、編輯、發(fā)布和托管文檔,特別適合于技術(shù)文檔、教程、手冊等領(lǐng)域的文檔編寫和發(fā)布。 GitBook平臺支持多種文檔格式,包括Markdown、Asciidoc和reStructuredText等,同時

    2024年02月07日
    瀏覽(24)
  • 超級詳細GitBook和GitLab集成步驟【linux環(huán)境】

    超級詳細GitBook和GitLab集成步驟【linux環(huán)境】

    本文主要是在 gitlab 上集成 gitbook 實現(xiàn)提交時 gitbook 自動刷新部署 ,以及在 linux 環(huán)境上搭建 gitlab gitbook,集成 GitLab CI 實現(xiàn)一個企業(yè)級或個人的 Wiki 系統(tǒng) 1.一臺 linux 服務(wù)器 2.安裝 node 以及 npm 環(huán)境 (這里注意 node 環(huán)境不要過高 不然在安裝 gitbook 時會有報錯 推薦:v12.16.3) 在 root

    2024年02月09日
    瀏覽(19)
  • Gitbook超詳細使用教程,搭建屬于你自己的博客!

    Gitbook 是一個平臺,允許用戶創(chuàng)建和分享內(nèi)容豐富的在線書籍。它有一個用戶友好的界面,可以快速地寫作、編輯和發(fā)布你的電子書。這里是一個按照 Gitbook 的基本步驟 打開GitBook官網(wǎng),這里我選擇使用github賬號來登錄,當然你也可以自己新建一個賬號 點擊左下角的加號,選

    2024年02月04日
    瀏覽(19)
  • 網(wǎng)絡(luò)拓撲結(jié)構(gòu)入門快速介紹

    網(wǎng)絡(luò)拓撲結(jié)構(gòu)入門快速介紹

    (1)一層交換機是指工作于OSI模型的第1層(物理層)只支持物理層協(xié)議的交換機(例如電話程控交換機); (2)二層交換機是指工作于OSI模型的第2層(數(shù)據(jù)鏈路層)支持物理層和數(shù)據(jù)鏈路層協(xié)議的交換機 例如以太網(wǎng)交換機); (3)三層交換機是指工作在OSI網(wǎng)絡(luò)標準模型

    2024年02月16日
    瀏覽(20)
  • 制造領(lǐng)域 基礎(chǔ)概念快速入門介紹

    制造領(lǐng)域 基礎(chǔ)概念快速入門介紹

    目錄 1、基本背景知識? 2、什么是BOM? 3、BOM有什么作用? 4、BOM有哪些形式? 4.1????按照用途劃分 工程BOM——EBOM(Engineering BOM): 計劃BOM——PBOM(Plan BOM): 設(shè)計BOM——DBOM(Design BOM): 制造BOM——MBOM(Manufacturing BOM): 客戶BOM——CBOM(Customer BOM): 銷售BOM——SBOM(SALE BOM): 維修

    2024年01月20日
    瀏覽(22)
  • Gin 框架介紹與快速入門

    Gin 框架介紹與快速入門

    目錄 Gin 框架介紹與快速入門 一、Gin框架介紹 1. 快速和輕量級 2. 路由和中間件 3. JSON解析 4. 支持插件 5. Gin相關(guān)文檔 二、基本使用 1.安裝 2.導(dǎo)入 3.第一個Gin 應(yīng)用 三、應(yīng)用舉例 四、Gin 入門核心 1.gin.Engine 2.gin.Context Gin是一個輕量級的Go語言Web框架,它具有高性能和簡潔的設(shè)計

    2024年02月03日
    瀏覽(22)
  • Prometheus介紹安裝和快速入門

    Prometheus介紹安裝和快速入門

    1.1 什么是 Prometheus? Prometheus(普羅米修斯)是古希臘的一個神明,名字的意思是「先見之明」。從它的名字可以看出, Prometheus 是做「先見之明」的監(jiān)控告警用途。維基百科簡單寫了它的作用:Prometheus is a free software application used for event monitoring and alerting(Prometheus 是用來監(jiān)控

    2024年02月10日
    瀏覽(19)
  • Spring Cloud 快速入門基本介紹

    Spring Cloud 快速入門基本介紹

    ??前言 本篇博文是關(guān)于Spring Cloud 基本介紹,希望你能夠喜歡 ??個人主頁:晨犀主頁 ??個人簡介:大家好,我是晨犀,希望我的文章可以幫助到大家,您的滿意是我的動力???? ??歡迎大家:這里是CSDN,我總結(jié)知識的地方,歡迎來到我的博客,感謝大家的觀看?? 如果文

    2024年02月10日
    瀏覽(20)
  • 思通輿情 是一款開源免費的輿情系統(tǒng) 介紹

    思通輿情 是一款開源免費的輿情系統(tǒng) 介紹

    思通輿情 是一款開源免費的輿情系統(tǒng)。 支持本地化部署,支持在線體驗。 支持對海量輿情數(shù)據(jù)分析和挖掘。 無論你是使用者還是共同完善的開發(fā)者,歡迎 pull request 或者 留言對我們提出建議。 您的支持和參與就是我們堅持開源的動力!請? ?star?或者?fork! 思通輿情 的功能

    2024年04月13日
    瀏覽(26)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包