[][src]Function mdbook::book::parse_summary

pub fn parse_summary(summary: &str) -> Result<Summary>

Parse the text from a SUMMARY.md file into a sort of "recipe" to be used when loading a book from disk.

Summary Format

Title: It's common practice to begin with a title, generally "# Summary". It's not mandatory and the parser (currently) ignores it, so you can too if you feel like it.

Prefix Chapter: Before the main numbered chapters you can add a couple of elements that will not be numbered. This is useful for forewords, introductions, etc. There are however some constraints. You can not nest prefix chapters, they should all be on the root level. And you can not add prefix chapters once you have added numbered chapters.

[Title of prefix element](relative/path/to/markdown.md)

Part Title: An optional title for the next collect of numbered chapters. The numbered chapters can be broken into as many parts as desired.

Numbered Chapter: Numbered chapters are the main content of the book, they will be numbered and can be nested, resulting in a nice hierarchy (chapters, sub-chapters, etc.)

# Title of Part

- [Title of the Chapter](relative/path/to/markdown.md)

You can either use - or * to indicate a numbered chapter, the parser doesn't care but you'll probably want to stay consistent.

Suffix Chapter: After the numbered chapters you can add a couple of non-numbered chapters. They are the same as prefix chapters but come after the numbered chapters instead of before.

All other elements are unsupported and will be ignored at best or result in an error.