Skip to content
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

added exclude_h1 option to remove highest layer of numbering #39

Closed
wants to merge 0 commits into from

Conversation

TimChaubet-I4U
Copy link

We've added the exclude_h1 boolean option to exclude the highest layer of numbering from output.
In case you only have one (or a few) header level 1 titles, and you don't want this layer to be numbered, you can set this to true.

So if you set in the yaml:

plugins:
  - enumerate-headings: 
      toc_depth: 6
      strict: false
      increment_across_pages: false
      exclude_h1: true

These markdown titles ...

# Top Layer Title
## subA
### someother title
## subB

will translate to

Top Layer Title

1. subA

1.2 someother title

2. subB

Copy link
Owner

@timvink timvink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, open to adding this!

Please remove the unnecessary comments. It would also be great if you could include a unit test to ensure this works (and keeps working in the future)

README.md Outdated Show resolved Hide resolved
mkdocs_enumerate_headings_plugin/heading.py Outdated Show resolved Hide resolved
mkdocs_enumerate_headings_plugin/heading.py Outdated Show resolved Hide resolved
mkdocs_enumerate_headings_plugin/heading.py Outdated Show resolved Hide resolved
mkdocs_enumerate_headings_plugin/plugin.py Outdated Show resolved Hide resolved
@timvink
Copy link
Owner

timvink commented Nov 23, 2023

Actually this might be done simpler.. you can try using the on_post_page() event like here:

https://github.com/timvink/mkdocs-enumerate-headings-plugin/pull/36/files#r1403687795

Copy link
Author

@TimChaubet-I4U TimChaubet-I4U left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed redundant comments & beautified the readme.md line
To be honest, I'm not sure what you are aiming at when you mention the on_post event. Could you elaborate a bit more?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants