使用gitbook寫電子書

tags: solution

what

gitbook是什么?
gitbook是用來寫電子書的,公開的電子書別人也能看到,私有的電子書需要付費(fèi)才能寫。上面有很多高質(zhì)量的電子書,比如李笑來的《新生.七年就是一輩子》。

how

使用很簡單。

  • 首先去它的官網(wǎng)注冊一個賬號。
    注冊完畢,登錄進(jìn)去新建一本書。根據(jù)需要選擇電子書類型,一般選擇第一個就好了。

    enter description here
    enter description here

  • 電子書創(chuàng)建完畢后就可以編輯了。


    enter description here
    enter description here
  • 右鍵點(diǎn)擊空白處可以選擇添加一個章節(jié)或者一篇文章。


    enter description here
    enter description here
  • 點(diǎn)擊右下角的問號可以切換到markdown模式。


    enter description here
    enter description here
  • GitBook Editor
    gitbook有一個編輯器客戶端,界面和網(wǎng)頁版一樣。

OK,你已經(jīng)可以動手去寫自己的電子書了。

==如果你不是一個碼農(nóng),下面的內(nèi)容可以不看了。==

gitbook工具以及gitbook平臺

gitbook其實(shí)有兩個概念:一是gitbook工具,可以在本地使用它發(fā)布電子書服務(wù);二是gitbook電子書平臺,這個平臺使用git管理你的文章并用gitbook工具幫你發(fā)布服務(wù)。兩者的關(guān)系類似git和github。

gitbook本身也是開源項目,倉庫在這里。上面有官方的使用說明文檔。

本地使用gitbook工具

如有需要,直接查看官方文檔
照我的做也一樣。

  • 安裝nodejs。直接百度搜索,下載安裝之。
  • 打開windows的命令行,win10用戶直接右鍵開始菜單選擇"Windows PowerShell"。輸入
    npm install gitbook-cli -g
  • 在你的電腦磁盤上新建一個文件夾,例如"newbook"。然后創(chuàng)建一個"README.md"和一個"SUMMARY.md",這兩個文件是必須的。
  • SUMMARY.md里描述了電子的目錄結(jié)構(gòu)。修改其內(nèi)容如下:
# Summary

* [Introduction](README.md)
* [chapter1](c1/README.md)
   * [c1.1](c1/c1.1.md)
   * [c1.2](c1/c1.2.md)
* [chapter2](c2/README.md)
  • 中括號里的是會顯示在電子書目錄上的名字,小括號里具體對應(yīng)的文件。==除了前面兩個文件,其他文件不需要你創(chuàng)建,執(zhí)行gitbook init后自動創(chuàng)建出來。
    enter description here
    enter description here
  • 可以使用tree命令查看當(dāng)前電子書結(jié)構(gòu) 。
    enter description here
    enter description here
  • 確認(rèn)無誤后就可以執(zhí)行gitbook server啟動服務(wù)了。服務(wù)啟動成功后就可以在瀏覽器里輸入http://localhost:4000進(jìn)行查看。
    enter description here
    enter description here
  • 效果如下:
enter description here
enter description here

使用git管理電子書

gitbook平臺是以git的形式存放電子書內(nèi)容的。電子書對應(yīng)的Edit旁的倒三角,可以獲得其git鏈接。

enter description here
enter description here

然后就可以git克隆到本地進(jìn)行操作了。

gitbook可以綁定到github

這部分的官網(wǎng)文檔在這里。

首先,你需要去github新建一個倉庫。

然后,進(jìn)入電子書的SETTING頁面,選擇GitHub。

enter description here
enter description here

如果你沒有綁定過github,會先提示你去github安裝gitbook的服務(wù)。


enter description here
enter description here

點(diǎn)擊后去gitbub安裝gitbook服務(wù)。


enter description here
enter description here

選擇要給gitbook開通權(quán)限的倉庫(前面已經(jīng)創(chuàng)建好)。


enter description here
enter description here

這個時候再回到gitbook的github綁定界面,就會提示gitbook已經(jīng)和github同步了。兩者任一的改動都會同步到另一個。


enter description here
enter description here

看云

看云是國內(nèi)版的gitbook,由于服務(wù)器在國內(nèi),網(wǎng)絡(luò)更好,而且有些操作更方便。因?yàn)間itbook一樣都是用git管理文章的,所以以后也可以clone下來,不用擔(dān)心數(shù)據(jù)在他們平臺綁死。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容