While testing your plugin, I came across the following problem:
If a mkdocs.yml file specifies a navigation structure with "empty" levels (as shown below), the structure is not maintained in the resulting PDF document.
The expected behavior would be to have a chapter structure as follows:
Report Summary
Weekly reports
+- 2024
+- September
+- 2024.09.01
+- <section structures as defined in the md-file>
+- 2024.09.08
+- <section structures as defined in the md-file>
However, the combined document uses the unmodified heading levels from each source document. As a result, the document's structure becomes inconsistent:
Report Summary
Weekly reports
2024.09.01
+- <section structures as defined in the md-file>
2024.09.08
+- <section structures as defined in the md-file>
This pull request provides a potential solution by altering the combining process in such a way, that the headings of the source files are aligned to their actual position in the structure of the document, based on the nav section of the configuration file. This is achieved by adding sufficient #-characters to the headings.
I've tested this proposal on my machine and it seems to solve the case outlined above. However, Python not being my primary programming language and me being even less familiar with MkDocs object model. it's defeinitely worth taking a closer look at the implementation and its impact. I'm pretty sure there is still room for improvement. Maybe its even worth considering to have this behaviour configurable.
I'm looking forward for your feedback, @alexandre-perrin .
While testing your plugin, I came across the following problem:
If a mkdocs.yml file specifies a navigation structure with "empty" levels (as shown below), the structure is not maintained in the resulting PDF document.
The expected behavior would be to have a chapter structure as follows:
However, the combined document uses the unmodified heading levels from each source document. As a result, the document's structure becomes inconsistent:
This pull request provides a potential solution by altering the combining process in such a way, that the headings of the source files are aligned to their actual position in the structure of the document, based on the
nav
section of the configuration file. This is achieved by adding sufficient#
-characters to the headings.I've tested this proposal on my machine and it seems to solve the case outlined above. However, Python not being my primary programming language and me being even less familiar with
MkDocs
object model. it's defeinitely worth taking a closer look at the implementation and its impact. I'm pretty sure there is still room for improvement. Maybe its even worth considering to have this behaviour configurable.I'm looking forward for your feedback, @alexandre-perrin .