GitbookIO/gitbook — pull request #312 by citizenmatt (2014-06-13 11:27:39+00:00)
Title: Multi part books

Allows a book to be split into "parts", as per issue #306. Instead of a single list of chapters, there are now groups of chapters, mimicking the style seen in many text books ("Part I - Introduction", "Part 2 - Practical Work", "Part 3 - Additional Exercises", etc). The text is plain text, allowing for any format - parts, books, sections, appendices.

Parts are displayed without a level number (although internally they still have one, so progress still works). They appear as top level items, similar to the "Introduction" item in the summary. They can have a link or not. If they don't have a link, they are not greyed out, and act simply as a heading.

To add a part heading, add a second level heading in the `SUMMARY.md` file. Like:

# Summary

## Part 1
* Chapter 1
* Chapter 2

## Part 2
* Chapter 1
* Chapter 2

Because the part's level number is stripped from display, this looks like:

Part 1
1. Chapter 1
2. Chapter 2

Part 2
1. Chapter 1
2. Chapter 2

Backwards compatibility: The `summary` object returns a new `parts` property which has a child property of `chapters`, which is a traditional list of chapters. To maintain compatibility with existing templates, the `chapters` property is still available on the `summary` object, with each part heading given a level number. If this property is used, parts will be rendered as simple chapters.

This PR only includes changes to the main site template, as that's all I need right now. I can add the templates if you want, though.