rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.4k stars 1.65k forks source link

Bug: separator gets folded by subsection #2362

Closed expikr closed 6 months ago

expikr commented 7 months ago

0.4.37

# book.toml
output.html.fold.enable = true
<!-- SUMMARY.md -->
- [Chapter 1](./chapter_1.md)
- [Chapter 2](./chapter_2.md)
  - [Hidden Section](./hidden-section.md)

---

[Credits](./credits.md)

image

image

expikr commented 7 months ago

The issue would be solved by moving the divider <li> onto the same level as chapter items rather than being nested under the immediately preceding section level.

I'd like to dig into this but can't figure out which part of the codebase populates the toc, if I can get a quick pointer then it'd greatly speed up the process.

ehuss commented 7 months ago

The spacer is added to the TOC here. It's a bit tricky how that interacts with current_level. At a glance I'm not sure how that should be better organized.

ehuss commented 7 months ago

Note, this is a duplicate of #733.

expikr commented 7 months ago

Fixed by #2364

Turns out the fix is as simple as just moving the divider processing to the same spot as part titles, no change to the logic whatsoever.