快速开始
让我们开始使用 GitBook 解析器!
安装
pnpm install
构建项目
pnpm build
基本使用
生成 HTML 网站
pnpm start html --input ./docs --output ./dist/html --title "我的文档"
生成 PDF 文件
pnpm start pdf --input ./docs --output ./dist/pdf --title "我的文档"
同时生成 HTML 和 PDF
pnpm start all --input ./docs --output ./dist --title "我的文档"
使用配置文件
把常用参数写进项目根目录的 bookforge.yml,之后就不用每次都敲一长串参数:
input: ./docs
output: ./dist/html
title: 我的文档
navLinks:
- text: GitHub
url: https://github.com/yunnysunny/bookforge
pnpm start html
完整字段和优先级规则见配置说明。
项目结构
确保你的文档目录结构如下:
docs/
├── README.md # 入口文件
├── introduction.md # 介绍
├── getting-started.md # 快速开始
└── api-reference.md # API 参考
入口文件
GitBook 解析器会查找以下入口文件:
README.mdSUMMARY.mdindex.md
入口文件应该包含文档的目录结构,例如:
# 我的文档
## 目录
* [介绍](./introduction.md)
* [快速开始](./getting-started.md)
* [API 参考](./api-reference.md)