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
base: 1.0.dev
from

Conversation

Projects
None yet
2 participants
@funkyfuture
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

funkyfuture commented Sep 7, 2017

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 force-pushed the funkyfuture:toc_depth branch from 804d818 to 2d99a8e Sep 7, 2017

@funkyfuture funkyfuture changed the base branch from master to 1.0.dev Sep 7, 2017

funkyfuture added a commit to funkyfuture/mkdocs-material that referenced this pull request Sep 7, 2017

Allows to restrict included toc items by their level
Depends on mkdocs 1.0 and asserts that mkdoc's AnchorLink has a property
named 'level' (mkdocs/mkdocs#1272).

@waylan waylan added this to the 1.0.0 milestone Sep 7, 2017

@waylan

This comment has been minimized.

Member

waylan commented Sep 7, 2017

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

@funkyfuture funkyfuture force-pushed the funkyfuture:toc_depth branch from 2d99a8e to 80cd526 Sep 7, 2017

@funkyfuture

This comment has been minimized.

Contributor

funkyfuture commented Sep 7, 2017

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

@funkyfuture funkyfuture force-pushed the funkyfuture:toc_depth branch from 80cd526 to e97337e Sep 8, 2017

Adds a AnchorLink.level property
This allows themes to restrict the toc to a certain depth.

@funkyfuture funkyfuture force-pushed the funkyfuture:toc_depth branch from e97337e to d8b494c Sep 21, 2017

funkyfuture added a commit to funkyfuture/mkdocs-material that referenced this pull request Nov 10, 2017

Allows to restrict included toc items by their level
Depends on mkdocs 1.0 and asserts that mkdoc's AnchorLink has a property
named 'level' (mkdocs/mkdocs#1272).

waylan added a commit to waylan/mkdocs that referenced this pull request Jun 29, 2018

Add a level attribute to AnchorLinks.
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

Add a level attribute to AnchorLinks.
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