mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Adding section titles to ToC / sidebar

Open rimutaka opened this issue 3 years ago • 3 comments

@ehuss , Eric, would you consider a PR for the following feature ...

At the moment the sidebar is constructed out of the items listed in SUMMARY.md. It would be helpful to include an additional level out of Hx titles found in the markdown content in the ToC as an optional feature.

At the moment Hx tags are wrapped into with #-anchors, so we just need to add them to the ToC in the right place.
The list of H-levels can be included in book.toml as a setting.

rimutaka avatar May 22 '22 11:05 rimutaka

I'm interested, but I think several points need to be settled on before this can be implemented:

  • [ ] How does this interact with folding levels? Are those part of the same folding level set as pages, or do they use their own set of levels?
  • [ ] Should this be put behind a global toggle? It may be costly due to requiring a parse of all content files instead of just SUMMARY.md.
  • [ ] Should all sections be shown for all pages, or only the current page?

ISSOtm avatar Jun 18 '22 09:06 ISSOtm

@ISSOtm Can it be this form https://github.com/rust-lang/mdBook/issues/167#issuecomment-1293626374? It is very convenient if we can render section titles in sidebar just by adding anchors.

bioinformatist avatar Nov 13 '22 09:11 bioinformatist

I guess it could, but the above points as well as those still need to be resolved.

ISSOtm avatar Nov 13 '22 15:11 ISSOtm