Skip to content

Allows to restrict included toc items by their level - #450

Closed
funkyfuture wants to merge 4 commits into
squidfunk:masterfrom
funkyfuture:toc_depth
Closed

funkyfuture wants to merge 4 commits into
squidfunk:masterfrom
funkyfuture:toc_depth

Conversation

@funkyfuture

Copy link
Copy Markdown

asserts that mkdoc's AnchorLink has a property named 'level', see mkdocs/mkdocs#1272.

so, atm this is a proof-of-concept.

Asserts that mkdoc's AnchorLink has a property named 'level'
@squidfunk

Copy link
Copy Markdown
Owner

Thanks for your PR. Three notes:

  • You made changes in the material folder, which are overwritten by the build. See this section on how to PR on this project.

  • I don't know if this makes sense in general. I think it's better to use <h*> tags for specific headlines which you don't want to appear in the documentation, or CSS, e.g. .md-nav--secondary .md-nav__list .md-nav__list .md-nav__list { display: none }, to remove entire levels from the table of contents.

  • You changed the dependency for mkdocs to 0.17, which does not exist, thus the build fails.

@funkyfuture

Copy link
Copy Markdown
Author

You made changes in the material folder, which are overwritten by the build.

when i run yarn install, i get this error:

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=5.0.0".
error Found incompatible module

do you have a hint what may cause that?

I think it's better to use <h*> tags for specific headlines which you don't want to appear in the documentation

i'm not sure if there's a misunderstanding. this is not about excluding headings from a page's contents, but from the toc on the side. these are a elements in lis with the md-nav__link / md-nav__item class assigned. unless there'd be an option to collapse sub-items, i think the excluded items would bloat the html, in particular in cases where there are e.g. a lot of fourth order headings which ought not to be displayed.

You changed the dependency for mkdocs to 0.17, which does not exist, thus the build fails.

this is anticipating that the feature will depend on a future release of mkdocs. should i point the dependency to my branch that includes the required change for now?

@squidfunk

Copy link
Copy Markdown
Owner

Regarding the error, you are probably running a node version below 5.

I understood what you wanted to do, but I won't merge something that depends on a future release of MkDocs that isn't even released. Furthermore, I want to keep things backward compatible, as many, many people are probably running 0.16.x right now. Sorry, but for me this PR doesn't sound like a good idea, so I cannot merge it.

@funkyfuture

Copy link
Copy Markdown
Author

I understood what you wanted to do, but I won't merge something that depends on a future release of MkDocs that isn't even released.

as i stated this is a proof-of-concept in regards to the linked pr and i don't expect it to be merged before the dependent is released. thus i appreciate the debate towards a solution.

of course i can work with patched versions of mkdocs and mkdocs-material, but there's an interest for such feature which is imo essential for large documents. Sphinx has a maxdepth option for its toctree which is commonly used.

@squidfunk

Copy link
Copy Markdown
Owner

Okay, but as this is a proof of concept which depends on a release of an upstream project that isn't even scheduled with a feature that isn't even merged, I would ask you to close it, because it is unclear how long it will float around here. You can re-open it later, when the feature is merged into MkDocs and then we can think about how we will tackle the problem.

@funkyfuture

Copy link
Copy Markdown
Author

okay. i amended some commits regarding the building you might want to cherry-pick.

@squidfunk

Copy link
Copy Markdown
Owner

Thanks!

@squidfunk

Copy link
Copy Markdown
Owner

I updated the contributing.md with a link to the build theme and symlinked the file in the docs to the top-level file - that was a good idea. The scripts are bound to change, will update them later. Closing this issue (for) now.

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