Closed loneguardian closed 4 months ago
This would be great. It is very painful to have to go around adding h1s to docs to get them to work.
Agreed. It's a pain to add these h1's after the fact.
This one is tricky. The most common 'mistake' I've seen is that people use a secondary level heading as the first heading on a page, like so:
## title
content
Then other pages have normal titles again like so:
# title
content
When you combine these pages, the level of the title is not identical, which really messes up the layout and the TOC (the small one on the right):
Hence the logic to detect this and raise an error (also deals with the edge case that there are pages that have no title at all, because some users indeed it to be part of the previous page when the entire site is combined into a single page, or because they just didn't want a title).
You propose using the mkdocs behaviour of page titles, which is actually just using page.title
. I went down the rabbit hole and I think I have a fix. The new behavior is to raise a warning instead of an error (which will become an error for users that use mkdocs build --strict
)
The unit tests pass.. but before I release it I'd appreciate if someone could give it a spin for their use case. Maybe @sblausten or @dtuite ? You can install it form the pull request branch: https://github.com/timvink/mkdocs-print-site-plugin/pull/104
pip install git+https://github.com/timvink/mkdocs-print-site-plugin.git@support_missing_h1
If it works I'll merge and release on pypi.
This is more of a feature request than bug report.
I am trying to use this plugin but the majority of the docs do not have a level 1 heading, resulting in almost all of them triggering the following error:
To enhance the compatibility of this plugin regarding page title, I would like to propose for the plugin to mimic the MkDocs behaviour of determining the page title: