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

Adds a AnchorLink.level property #1272

Closed
wants to merge 1 commit into from
Closed

Adds a AnchorLink.level property #1272

wants to merge 1 commit into from

Conversation

funkyfuture
Copy link
Contributor

@funkyfuture funkyfuture commented Sep 6, 2017

this allows themes to restrict the toc to a certain depth.

here's a proof-of-concept: squidfunk/mkdocs-material#450

@waylan
Copy link
Member

waylan commented Sep 6, 2017

Hmm, so this adds a level attribute to the AnchorLink class to track the "level" of each item in a template. Is that really necessary? Why can't you track that with a template variable? In other words, convince me this is the right approach to the problem.

Regardless, this would need to have some tests. Also, it should be against the 1.0.dev branch. Finally, as this would be a 1.0 feature, the template specific setting (in the associated Material PR) may want to take advantage of the new template settings implemented in #1201,

@funkyfuture
Copy link
Contributor Author

Is that really necessary? Why can't you track that with a template variable? In other words, convince me this is the right approach to the problem.

in general i tend to keep the logic in templates at a minimum and rather pass rich context objects. imo this is easier to read in the templates. also, all theme developers and users can easily access this information w/o implementing a logic for it. it's obviously simply implemented and maintainable on the Python side.

thanks for the other hints.

@funkyfuture funkyfuture changed the base branch from master to 1.0.dev September 7, 2017 11:51
@waylan waylan added this to the 1.0.0 milestone Sep 7, 2017
@waylan
Copy link
Member

waylan commented Sep 7, 2017

Add some tests and I'll give this another look.

@funkyfuture
Copy link
Contributor Author

a test is added. the fails are caused by missing interpreters.

This allows themes to restrict the toc to a certain depth.
waylan added a commit to waylan/mkdocs that referenced this pull request Jun 29, 2018
This relimplements mkdocs#1272 on the current code in master. Thanks to 
@funkyfuture for the original work on this.

Also removes some unused code after mkdocs#1504.

Closes mkdocs#1272.
@waylan waylan closed this in #1520 Jun 29, 2018
waylan added a commit that referenced this pull request Jun 29, 2018
This relimplements #1272 on the current code in master. Thanks to 
@funkyfuture for the original work on this.

Also removes some unused code after #1504.

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

Successfully merging this pull request may close these issues.

None yet

2 participants