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