| 1 |
# SUMMARY.md |
| 2 |
|
| 3 |
The summary file is used by mdBook to know what chapters to include, in what |
| 4 |
order they should appear, what their hierarchy is and where the source files |
| 5 |
are. Without this file, there is no book. |
| 6 |
|
| 7 |
This markdown file must be named `SUMMARY.md`. Its formatting |
| 8 |
is very strict and must follow the structure outlined below to allow for easy |
| 9 |
parsing. Any element not specified below, be it formatting or textual, is likely |
| 10 |
to be ignored at best, or may cause an error when attempting to build the book. |
| 11 |
|
| 12 |
### Structure |
| 13 |
|
| 14 |
1. ***Title*** - While optional, it's common practice to begin with a title, generally <code |
| 15 |
class="language-markdown"># Summary</code>. This is ignored by the parser however, and |
| 16 |
can be omitted. |
| 17 |
```markdown |
| 18 |
# Summary |
| 19 |
``` |
| 20 |
|
| 21 |
1. ***Prefix Chapter*** - Before the main numbered chapters, prefix chapters can be added |
| 22 |
that will not be numbered. This is useful for forewords, |
| 23 |
introductions, etc. There are, however, some constraints. Prefix chapters cannot be |
| 24 |
nested; they should all be on the root level. And you cannot add |
| 25 |
prefix chapters once you have added numbered chapters. |
| 26 |
```markdown |
| 27 |
[A Prefix Chapter](relative/path/to/markdown.md) |
| 28 |
|
| 29 |
- [First Chapter](relative/path/to/markdown2.md) |
| 30 |
``` |
| 31 |
|
| 32 |
1. ***Part Title*** - |
| 33 |
Level 1 headers can be used as a title for the following numbered chapters. |
| 34 |
This can be used to logically separate different sections of the book. |
| 35 |
The title is rendered as unclickable text. |
| 36 |
Titles are optional, and the numbered chapters can be broken into as many parts as desired. |
| 37 |
Part titles must be h1 headers (one `#`), other heading levels are ignored. |
| 38 |
```markdown |
| 39 |
# My Part Title |
| 40 |
|
| 41 |
- [First Chapter](relative/path/to/markdown.md) |
| 42 |
``` |
| 43 |
|
| 44 |
1. ***Numbered Chapter*** - Numbered chapters outline the main content of the book |
| 45 |
and can be nested, resulting in a nice hierarchy |
| 46 |
(chapters, sub-chapters, etc.). |
| 47 |
```markdown |
| 48 |
# Title of Part |
| 49 |
|
| 50 |
- [First Chapter](relative/path/to/markdown.md) |
| 51 |
- [Second Chapter](relative/path/to/markdown2.md) |
| 52 |
- [Sub Chapter](relative/path/to/markdown3.md) |
| 53 |
|
| 54 |
# Title of Another Part |
| 55 |
|
| 56 |
- [Another Chapter](relative/path/to/markdown4.md) |
| 57 |
``` |
| 58 |
Numbered chapters can be denoted with either `-` or `*` (do not mix delimiters). |
| 59 |
|
| 60 |
1. ***Suffix Chapter*** - Like prefix chapters, suffix chapters are unnumbered, but they come after |
| 61 |
numbered chapters. |
| 62 |
```markdown |
| 63 |
- [Last Chapter](relative/path/to/markdown.md) |
| 64 |
|
| 65 |
[Title of Suffix Chapter](relative/path/to/markdown2.md) |
| 66 |
``` |
| 67 |
|
| 68 |
1. ***Draft chapters*** - Draft chapters are chapters without a file and thus content. |
| 69 |
The purpose of a draft chapter is to signal future chapters still to be written. |
| 70 |
Or when still laying out the structure of the book to avoid creating the files |
| 71 |
while you are still changing the structure of the book a lot. |
| 72 |
Draft chapters will be rendered in the HTML renderer as disabled links in the table |
| 73 |
of contents, as you can see for the next chapter in the table of contents on the left. |
| 74 |
Draft chapters are written like normal chapters but without writing the path to the file. |
| 75 |
```markdown |
| 76 |
- [Draft Chapter]() |
| 77 |
``` |
| 78 |
|
| 79 |
1. ***Separators*** - Separators can be added before, in between, and after any other element. They result |
| 80 |
in an HTML rendered line in the built table of contents. A separator is |
| 81 |
a line containing exclusively dashes and at least three of them: `---`. |
| 82 |
```markdown |
| 83 |
# My Part Title |
| 84 |
|
| 85 |
[A Prefix Chapter](relative/path/to/markdown.md) |
| 86 |
|
| 87 |
--- |
| 88 |
|
| 89 |
- [First Chapter](relative/path/to/markdown2.md) |
| 90 |
``` |
| 91 |
|
| 92 |
|
| 93 |
### Example |
| 94 |
|
| 95 |
Below is the markdown source for the `SUMMARY.md` for this guide, with the resulting table |
| 96 |
of contents as rendered to the left. |
| 97 |
|
| 98 |
```markdown |
| 99 |
{{#include ../SUMMARY.md}} |
| 100 |
``` |