概要文件主要存放 GitBook 的文件目录信息,左侧的目录就是根据这个文件来生成的,默认对应的文件是 SUMMARY.md
,可以在 book.json
重新定义该文件的对应值。
它通过 Markdown 中的列表语法来表示文件的父子关系,下面是一个简单的示例:
# Summary
* [Part I](part1/README.md)
* [Writing is nice](part1/writing.md)
* [GitBook is nice](part1/gitbook.md)
* [Part II](part2/README.md)
* [We love feedback](part2/feedback_please.md)
* [Better tools for authors](part2/better_tools.md)
Each chapter has a dedicated page (part#/README.md
) and is split into subchapters.
Chapters in the Table of Contents can be pointing to specific part of a file using anchor.
# Summary
### Part I
* [Part I](part1/README.md)
* [Writing is nice](part1/README.md#writing)
* [GitBook is nice](part1/README.md#gitbook)
* [Part II](part2/README.md)
* [We love feedback](part2/README.md#feedback)
* [Better tools for authors](part2/README.md#tools)
The Table of Contents can be divided into parts separated by headings or horizontal lines:
# Summary
### Part I
* [Writing is nice](part1/writing.md)
* [GitBook is nice](part1/gitbook.md)
### Part II
* [We love feedback](part2/feedback_please.md)
* [Better tools for authors](part2/better_tools.md)
----
* [Last part without title](part3/title.md)
Parts are just groups of chapters and do not have dedicated pages, but according to the theme, it will show in the navigation.
Most of the files for GitBook use the Markdown syntax by default. GitBook infers your pages's structure from it. The syntax used is similar to the GitHub Flavored Markdown syntax. One can also opt for the AsciiDoc syntax.
# Title of the chapter
This is a great introduction.
## Section 1
Markdown will dictates _most_ of your **book's structure**
## Section 2
...
Pages can contain an optional front matter. It can be used to define the page's description. The front matter must be the first thing in the file and must take the form of valid YAML set between triple-dashed lines. Here is a basic example:
---
description: This is a short description of my page
---
# The content of my page
...
The front matter can define variables of your own, they will be added to the page variable so you can use them in your templating.