bep / docuapi

Beautiful multilingual API documentation theme for Hugo
https://docuapi.netlify.app/
Other
750 stars 200 forks source link

Combine headers of all pages before generating TOC #35

Closed khos2ow closed 4 years ago

khos2ow commented 4 years ago

By combining all the headers scattered around all the different pages before looping over them to generate the ToC, we can now safely distribute the contents on multiple smaller files.

Effectively creating a $combined slice consisting all the headers in all the .Site.RegularPages.Content and then looping over $combined

e.g:

10-main.md (define h1)
11-sub1.md (define h2 and multiple h3)
12-sub2.md (define h2)
20-second.md (define h1 and multiple h2 and h3)
21-sub1.md (define h2)
khos2ow commented 4 years ago

@bep please note that for the sake of example, and help reviewing this PR I added the second commit and broke down main.md file into smaller markdown files, feel free to let me know to revert them if the state of code change on this PR is acceptable, or otherwise let me know to break them down in more proper fashion (as an in place example of the capability of the theme)

bep commented 4 years ago

This looks great, thanks!. Much appreciated.