-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement support for book parts #1171
Conversation
All tests are passing locally for me. |
+1 -- looking for this. Currently, mdbook knows about this SUMMARY.md syntax but doesn't leverage: Using ## to indicate parts in SUMMARY.md is used at GitBook as well. This PR allows rendering of a matching Nav, while the current code drops the part names entirely. # Summary
## Use headings to create page groups like this one
* [First page's title](page1/README.md)
* [Some child page](page1/page1-1.md)
* [Some other child page](part1/page1-2.md)
* [Second page's title](page2/README.md)
* [Some child page](page2/page2-1.md)
* [Some other child page](part2/page2-2.md)
## A second-page group
* [Yet another page](another-page.md) GitBook doc: https://docs.gitbook.com/integrations/github/content-configuration#summary |
It's been a while -- I don't exactly remember, but I think I only implemented 1 level of headers in this PR... |
Thanks for your patience! I can't quite see why summary chapters are split into separate Also, this will need some documentation (probably in https://github.com/rust-lang/mdBook/blob/master/book-example/src/format/summary.md). |
@ehuss I don't really remember why I did that; I don't think it occurred to me when I was modifying the summary parser. It doesn't look that hard to change, if you would like me to. I can also update the documentation you pointed to. Does the comment on |
I don't know if there will be any problems, but I would probably prefer using |
@ehuss Done. I think it was a good idea, it reduced the diff somewhat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I pushed a small tweak to the documentation wording.
implement support for book parts
This allows the preprocessor to parse a `SUMMARY.md` that contains book parts, a feature added in 0.4.0: - rust-lang/mdBook#1171 - https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-040 This seems to work locally without any code changes.
Implements support for breaking the list of chapters in
SUMMARY.md
into parts. This is useful for really long books that (e.g. rustc-dev-guide).Some notable things:
mdbook
crate.SUMMARY.md
parser that I think cleans things up a bit. In particular, I gave the parser the ability to lookahead 1 token, which got rid of some edge cases and prevents every combinator from having to figure out if they are missing their first token. The new convention is that if your combinator discovers it has gone too far, it puts back the last token it read.Here is a sample of what it looks like: