google / gitiles

A simple browser for Git repositories.
https://gerrit.googlesource.com/gitiles/
Other
582 stars 174 forks source link

markdown TOC renderer should also include at least H4-level items #251

Open reavertm opened 2 years ago

reavertm commented 2 years ago

TOC is now explicitly generated from H1, H2 and H3. However, because of "H1 headers are omitted from the table of contents if there is only one level one header present. This allows H1 to be used as the document title without creating an unnecessary entry in the table of contents.", it makes it effectively two-level TOC only. Why is that you may ask.

When TOC is used, instead of file name, web page title is assigned from text in first found H1. Therefore to have cleanly titled pages, it is necessary to have single-H1 .md. Otherwise, this title entry will "pollute" TOC. This means, only H2 and H3 can be effectively used for any meaningful TOC. Which is arguably not enough.