-
Notifications
You must be signed in to change notification settings - Fork 876
adding toc_height to exclude upper headings, proposal for #786 and #637 #787
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
Conversation
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.
Thanks for your contribution.
In addition to the concerns mentioned below, I'm not sure "height" is the right word to describe this feature. To me a "height" of 4
means there are four levels, but that is not what the example int he tests shows. Perhaps that is why I'm struggling to understand the documentation. I don't actually understand what you are trying to do.
Both examples in the tests simply skip level 1. Perhaps one of them should do something other than that. As reminder, this is a feature that I find completely unnecessary, so perhaps I'm missing something obvious here. But if I am, then other users could be as well, which suggests the name and/or docs could be improved.
@waylan thanks for your quick response. You are right about the word height. I was unsure about the naming of Sorry for all these other issues, I will get into it and get back to you with an update on my PR. |
I fixed the flake error and changed the first test to a higher toc_height. I am still struggling with the parameters name
@waylan I know you find this feature "completely unnecessary", so I am very glad that you are dealing with me;) |
Your recent changes are a big improvement. They helped bring the new feature into focus for me. Thank you. I agree that However, adding this feature introduces another problem, in that I see a few ways forward:
Both for options 2 and 3, we would also need to handle the case where a user assigns values such that |
I like 3. best. With But |
As a reminder, users don't always provide config settings in Python. Sometimes they might be using a YAML file or similar. So specifically requiring a Python Personally I was thinking a string with the format |
I implemented the optional range for toc_depth. I tried to find a more elegant method than two if statements, but I hope this is ok. |
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.
Just a few tweaks and this should be good.
…witch between int and string and catching bad values
Using "try" is a good idea, sorry I missed this before.
I also thougt about using the AttributeError with the integer case:
I am not sure what is better.
At the moment I have no error handling, but a wrong value just gives you the whole Table of Contents and behaves like the toc_depth is not set at all. I think a warning should be very useful. But as long as I can see, there is no explicit error or warning-handling in Python-Markdown. When I set toc_depth to "foobar" in the existing code I get Thank you for your patience with this issue;) |
…iminate the need for try/except blocks in the conditionals
This looks good. Thank you. It just needs an item added to the 3.1 release notes under "New Features". |
I added a new config value toc_height. Using an array for toc_depth seems to me very unlikely.
test local