GitBook is a command line tool based on Node.js, you can use Github/Git and Markdown to make beautiful e-books
GitBook supports multiple document formats:
Static site: GitBook outputs this format by default, and the generated static site can be directly hosted on the Github Pages service;
PDF: Need to install gitbook-pdf dependency;
eBook: ebook-convert needs to be installed;
Single HTML webpage: Supports outputting content as single page HTML, but it is generally used in the intermediate process of converting e-book format to PDF or eBook;
JSON: Generally used for e-book debugging or metadata extraction.
To use GitBook to make e-books, two files are necessary: README.md and SUMMARY.md
The following describes how to deploy GitBook under CentOS7 system
1) Download the Linux64-bit binary package of Node.js from the official website
Download wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz
2) Unzip to the specified directory
tar -xJf node-v12.16.1-linux-x64.tar.xz -C /usr/local/lib/
cd /usr/local/lib
mv node-v12.16.1-linux-x64/ nodejs
3) Modify the environment variable vi /etc/profile
export PATH=/usr/local/lib/nodejs/bin:$PATH
source /etc/profile
And test whether there is an npm command, enter npm -v to view the version of npm
4) Install gitbook-cli using npm
npm install -g gitbook-cli
gitbook --version View version information, gitbook will be installed automatically when executed
5) gitbook init
gitbook initializes to create README.md and SUMMARY.md directory files
README.md is the documentation, and Summary.md is actually the chapter list of the book
6) Edit the Summary.md file example
[ Section 1: Commonly used scripts](Chapter1/Commonly used scripts.md)
[ Section 2: Common Commands](Chapter1/Common Commands.md)
[ Section 3: Linux release version](Chapter1/Linux release version.md)
[ Chapter 4] (Chapter4/README.md)
Execute the gitbook init command again. GitBook will look for the directories and files described in the Summary.md file, if not, it will create them
Then execute gitbook serve
Web browser to access port 4000
Of course, you can also manually specify the port as 80
gitbook serve --port 80
The above is the deployment of gitbook. You can use the markdown editing tool to write the content of the md file and then publish the e-book.
Summary: gitbook is closely related to Markdown and Git, and they are generally used in combination
1、 Choose the right Markdown editing tool to get a better writing experience; use GitBook to manage documents, preview and make e-books;
2、 At the same time, manage the changes of book content through Git and host them in the cloud (such as GitHub, GitLab, Code Cloud, or a Git server built by yourself) to achieve multi-person collaboration
Recommended Posts