Linux command
gitbook 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Initialize new book
gitbook init
Serve book locally
gitbook serve
Build static site
gitbook build
Build to specific output directory
gitbook build [.] [output_dir]
Serve with a specific version
gitbook build --gitbook=[2.0.1]
Install plugins
gitbook install
List locally installed versions
gitbook ls
List remote versions available
gitbook ls-remote
Install a specific version
gitbook fetch [version]
说明
gitbook is a command-line tool for building books and documentation from Markdown files. It generates static HTML sites or other formats like PDF and ePub. The tool uses a `book.json` configuration file and organizes content through `SUMMARY.md` for structure. Plugins extend functionality with custom features.
参数
- init
- Initialize book structure with README.md and SUMMARY.md.
- serve
- Build and serve book on localhost:4000.
- build
- Build static website.
- install
- Install plugins from book.json.
- Generate PDF (requires Calibre).
- epub
- Generate ePub.
- mobi
- Generate Mobi.
- ls
- List locally installed GitBook versions.
- ls-remote
- List remote versions available on NPM.
- fetch _version_
- Download and install a specific version.
- update
- Update to the latest GitBook version.
- uninstall _version_
- Remove a specific installed version.
- --gitbook _version_
- Force a specific GitBook version for the command.
- -d, --debug
- Enable verbose error output with stack traces.
- --log _level_
- Log level: debug, info, warn, error, disabled.
FAQ
What is the gitbook command used for?
gitbook is a command-line tool for building books and documentation from Markdown files. It generates static HTML sites or other formats like PDF and ePub. The tool uses a `book.json` configuration file and organizes content through `SUMMARY.md` for structure. Plugins extend functionality with custom features.
How do I run a basic gitbook example?
Run `gitbook init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does init do in gitbook?
Initialize book structure with README.md and SUMMARY.md.