timvink/mkdocs-enumerate-headings-plugin

Sub-number pages within sections

mfoulds opened this issue · 2 comments

Thanks for this great plug-in, and for mkdocs-print-site-plugin.

Is there a way to give sections a number, and then treat subsidiary pages as sub-pages? For example, if we had this nav structure:

nav
  - "Section 1":
    - 'Page 1.1': 'section1_page_1.md'
    - 'Page 1.2': 'section1_page_2.md'
  - "Section 2":
    - 'Page 2.1': 'section1_page_1.md'
    - 'Page 2.2': 'section1_page_2.md'
    - "Subsection 2.3":
      - "Page 2.3.1": "subsection_2.3.1_page.md"

Currently, Page 1.1 will be numbered as 1, Page 2.2 numbered as 4, etc. "Page 2.3.1" will be numbered as 4.1.

I couldn't find a way to treat sections as numbers, and the pages as subsections, as per the names shown in the example above. If there's no current option, is it a common enough use case to warrant an enhancement?

Not really. There is a new option called restart_increment_after. Perhaps if you manually number the sections, and then restart the increments after each?

If there's no current option, is it a common enough use case to warrant an enhancement?

I don't currently use this plugin, and find it a bit niche. After I wrote this plugin, I wrote https://github.com/timvink/mkdocs-print-site-plugin which does the numbering on the print page (which was much easier because all the pages were combined into a single page already, and I could use CSS). That one supports sections. However, I've since come to realize that for any serious technical publishing https://quarto.org/ is a much better match. Mkdocs is epic for technical documentation. I do still use mkdocs-material for documenting machine learning projects, which I now host internally as a website rather than storing PDFs.

So, I don't want to actively develop this plugin anymore. I will review PRs if you want to take a shot at it :)

Thanks Tim.

No luck so far with restart_increment_after but I'll persevere. Feel free to close this issue :).

I will review PRs if you want to take a shot at it :)

I suspect that's a little above my coding grade but I'll poke around _find_section_numbering in html_page.py.