-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom titles do not work if a page has multiple H1 headers #1078
Comments
This is an interesting one - I wonder if this is a decision made at the Sphinx level.
So based on point 2. I wonder if somewhere in Sphinx this was made as a conscious decision to only have one |
Yes I think that is basically it - the first header level is special and reserved for the title. All other headers are expected to be nested under it. If you add multiple top level headers, sphinx treats them as if they were different pages entirely. That's what messes up the TOC and sidebar stuff. I guess the question is whether we should be clever here and basically say "if there is more than one top level header then nest all subsequent headers under the first". The other thing that could be done is to support "title:" in the page metadata, and if that exists then nest the page content under a top level header of that name. |
as explained by @choldgraf Sphinx is treating each level 1 header as defining a new page in the toctree hence the confusion when there are multiple. The thing to keep in mind when using Sphinx is that it is designed for many other build type, not only HTML. In a Latex build, multiplying h1 level will lead to a very strange paginaltion of your document (same for ebooks). I think that's also why it's by design not suported. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I think the simplest thing to recommend would be to add a quick check for whether there are multiple top level sections in the page, and emit a warning to tell people to nest all headers under one title header |
Yup - I would prefer avoiding adding workarounds to an intentional design decision that also happens to help with our accessibility goals. And instead, encourage folks to use only one |
@choldgraf - since it seems we decided not to create a workaround due to accessibility concerns and potential issues with other output types (i.e. LateX), can we close this issue with |
I would simply leave this one open and reference/close it in/with the documentation update you want to make. |
fair enough |
If there are multiple H1 headers on a page (e.g., multiple
# Single hash
headers), then title over-rides that are specified in.. toctree::
objects do not work properly.To reproduce
Create a page with multiple H1 titles (e.g.
mypage.md
with# My title
and# My H1 title section
).In a parent page, link it with a toctree like:
And the title should not be over-ridden properly.
Originally reported in:
The text was updated successfully, but these errors were encountered: