tmcw/docbox

Support for additional nesting in left navigation?

atomarch opened this issue · 2 comments

Hello! We've been using docbox for our product documentation and it's been fantastic. Currently heading level 1-3 gives me nav as you see in the screenshot, and heading 4 (####) results in an example section.

Any easy way to enable deeper nesting in the left bar navigation? e.g. change so #### would be indented one level further in the left nav, and change ##### to examples?

screen shot 2018-11-28 at 6 51 03 pm

tmcw commented

Great to hear that docbox is working for you!

In the original implementation (Mapbox’s), we limited the heading hierarchy to 1-3, and relies on sort of a 'magic number' - you can see in navigation.js logic to highlight the nearest h3

https://github.com/tmcw/docbox/blob/master/src/components/navigation.js#L14-L24

and display up to 3 levels

https://github.com/tmcw/docbox/blob/master/src/components/navigation.js#L76-L86

Tweaking this limit should be a matter of another if/else in the render call, and tweaking the references to heading.level everywhere that there's a current limit.

Thanks! Will check it out.