Writing a Book with GitBook
Unlike a blog, a book is relatively more complete and more systematic. Blogs, by comparison, are much more scattered. However, excellent blog series are often adapted into books.
If you want to share larger-scale, systematic knowledge, writing a small book is a good choice.
This article introduces a tool called GitBook, which lets you write a book in Markdown, put it on GitHub, and generate web and PDF versions of the book. Compared with traditional LaTeX, it is simpler and more convenient. It suits contemporary programmers.
The references for this article mainly come from the official website. By comparison, this article is more focused and can help you quickly initialize, write, and publish a book.
Install gitbook command line tool:
1 | npm install gitbook-cli -g |
Create a book:
1 | gitbook init ./directory |
Preview and serve your book:
1 | gitbook serve |
Or build the static website:
1 | gitbook build |
Debug for better error message with stack trace:
1 | gitbook build ./ --log=debug --debug |