This documentation is built using GitBook, a documentation platform that makes it easy to create and maintain high-quality documentation.
We are using GitBook CLI version 3.2.3, which is the last stable version of the GitBook CLI tool. GitBook has since moved to a SaaS model, but the CLI is still widely used for self-hosted documentation.
To install GitBook CLI and set up the documentation locally, follow these steps:
- Node.js (v10.x or v12.x recommended, newer versions may have compatibility issues with GitBook CLI)
- v10.24.1 is guaranteed to work comfortably
- npm (comes with Node.js)
# Install GitBook CLI globally
npm install -g gitbook-cli@2.3.2
# Verify installation
gitbook --version
# Should display: CLI version: 2.3.2 and GitBook version: 3.2.3git clone https://github.com/sunriselayer/docs.git
cd docs# Install dependencies from package.json
npm install
# Install GitBook plugins
gitbook installTo preview the documentation locally:
# Start the GitBook server
gitbook serve
# Or if you want to specify a port
gitbook serve --port 4000The documentation will be available at http://localhost:4000 (or the port you specified).
To build the static files for production deployment:
# Build the book
gitbook build
# The output will be in the _book directoryGitBook configuration is stored in the book.json file, which defines plugins, theme configurations, and other settings.
Our project uses the following book.json configuration:
{
"plugins": [
"page-treeview",
"atoc",
"hints",
"tabs",
"tabs2",
"katex"
],
"pluginsConfig": {
"page-treeview": {
"copyright": ""
}
}
}- page-treeview: Displays the heading structure of the page as a tree view
- atoc: Automatically generates a table of contents
- hints: Provides blocks for adding notices such as hints, warnings, and information
- tabs: Allows creation of tabbed content
- tabs2: Provides additional tab functionality
- katex: Uses KaTeX for rendering mathematical expressions
.
├── book.json # GitBook configuration
├── README.md # Documentation home page
├── SUMMARY.md # Documentation structure/sidebar
├── learn/ # Learning resources
│ ├── README.md # Overview page for the section
│ └── ...
├── build/ # Build instructions
├── node/ # Node guides
└── ...
If you encounter issues with GitBook CLI:
-
Error: Need to install 'ebook-convert':
- This is only needed if you want to generate PDF/ePub files
- Install Calibre from https://calibre-ebook.com/download
-
Error with newer Node.js versions:
- Consider using nvm to switch to Node.js v12.x
- Alternative: Use Docker to run GitBook in a container
-
ENOENT errors during gitbook serve:
- Try removing the
_bookand.gitbookdirectories and running again
- Try removing the
When contributing to the documentation:
- Create a new branch for your changes
- Make your edits
- Test locally with
gitbook serve - Commit changes and create a pull request
The CI/CD pipeline will automatically build and deploy documentation changes after merging.