> For the complete documentation index, see [llms.txt](https://book.ainiok.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.ainiok.com/gong-ju/gitbook.md).

# gitbook

## Setup and Installation of GitBook

Getting GitBook installed and ready-to-go should only take a few minutes.

#### legacy.gitbook.com

[legacy.gitbook.com](https://legacy.gitbook.com) is an easy to use solution to write, publish and host books. It is the easiest solution for publishing your content and collaborating on it.

It integrates well with the [GitBook Editor](https://legacy.gitbook.com/editor).

#### 安装

**需求**

安装GitBook很简单，你的系统只要满足一下两个条件

* NodeJS (v4.0.0 以上)
* Windows, Linux, Unix, or Mac OS X

**用NPM安装**

安装GitBook的最好方式就是使用**NPM**，只需要运行一下命令

```
$ npm install gitbook-cli -g
```

`gitbook-cli` 是相同的系统上安装和使用多个版本的实用工具,它将自动安装所需版本的GitBook来构建一本书。

**新建书籍**

GitBook 可以生成一个样板书(**在当前目录**):

```
$ gitbook init
```

如果你想创建到一个新的目录，可以在后面加上目录 `gitbook init ./directory`

> README.md 和 SUMMARY.md 是两个必须文件，README.md 是对书籍的简单介绍

书籍目录结构创建完成以后，就可以使用 gitbook serve 来编译和预览书籍了:

```
$ gitbook serve
```

或使用静态网站构建:

```
$ gitbook build
```

`gitbook serve` 命令实际上会首先调用 gitbook build 编译书籍，完成以后会打开一个 web 服务器，监听在本地的 4000 端口。

**Install pre-releases**

`gitbook-cli` 可以下载和安装GitBook的其他版本来测试：

```
$ gitbook fetch beta
```

使用 `gitbook ls-remote` 列出可用于安装的版本.

**Debugging**

You can use the options `--log=debug` and `--debug` to get better error messages (with stack trace). For example:

```
$ gitbook build ./ --log=debug --debug
```

## 多语言 LANGS.md

> GitBook支持使用多语言来构建书本。按照GitBook的标准格式，每个语言应该作为一个子目录，命名为 LANGS.md 的文件应该遵循下面的格式并出现在仓库的根目录下：

```
* [中文](zh/)
* [英语](en/)
* [法语](fr/)
* [西班牙语](es/)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.ainiok.com/gong-ju/gitbook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
