Quick Start
Get your online book up and running in minutes.
Prerequisites
- A GitHub account
- Basic knowledge of Markdown
- Git installed on your machine
Step 1: Create Your Repository
Click "Use this template" on the GitHub repository page, or clone directly:
git clone https://github.com/tanghoong/gitbook-online-generator.git my-book
cd my-book
Step 2: Configure Your Book
Edit config.yml in the repository root:
title: "My Awesome Book"
author: "Your Name"
description: "A book about amazing things"
language: "en"
Step 3: Write Content
Create Markdown files inside the content/ folder:
content/
├── 01-introduction/
│ ├── 01-welcome.md
│ └── 02-overview.md
├── 02-chapters/
│ ├── 01-first-chapter.md
│ └── 02-second-chapter.md
Ordering Rules
- Use numeric prefixes like
01-,02-to control order - Folders become chapter headings in the table of contents
- Files become pages within chapters
Step 4: Push and Deploy
git add .
git commit -m "Add book content"
git push origin main
GitHub Actions will automatically build your book and deploy it to GitHub Pages.
Step 5: Enable GitHub Pages
- Go to your repository Settings
- Navigate to Pages
- Set source to GitHub Actions
- Your book will be live at
https://username.github.io/repo-name/
本地预览
You can also build and preview locally:
# Install dependencies
pip install -r scripts/requirements.txt
# Build the book
python scripts/build.py
# Serve locally
cd dist
python -m http.server 8000
Then open http://localhost:8000 in your browser.
Next: Learn about Markdown formatting in the next chapter.