-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
enumerate nav links #36
base: master
Are you sure you want to change the base?
Conversation
Hi @fmatter. Thanks for the PR. Makes sense to add that. Two comments:
|
Unfortunately, it's slightly more complicated: I think pages without headings will receive a I tried checking if there were no |
Ah I vaguely remember now having trouble with the navigation enumeration when I wrote this plugin. It's complex, plugins can mess with the title and navigation, and the navigation title can be set from mkdocs or can be inferred from the markdown. I'm sure it's possible, but I don't use this plugin anymore and already maintain too many mkdocs plugins, so I won't pursue this one. Shall we close the PR ? |
There we go! I think using |
Nice progress! |
OK, I've fixed the conditional and what was causing linting to fail. |
@timvink I think this is ready |
if self.config.get("enumerate_nav", True): | ||
output = output.replace(f"<h1>{page.chapter}. ", "<h1>") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since chapter numbers are added to
h1
titles it seems logical to me that you would want enumeration in the site navigation, too (which is distinct from the TOC). See the plugin demo gif, where chapter titles occur unnumbered in the navigation, and numbered in the body.(
exclude
works as expected)