Provide length of TableOfContents #1325
Comments
I assume you mean that you would like to have access to the length from within a template. Have you tried Jinja's builtin length filter? See how to use filters in templates here. How did that not meet your needs? Finally, there is no |
Yes. It throws saying that no That being said, could I do This is what I'm doing:
|
Oh, you want a |
Sorry. I don't really know what I'm doing, so I might be expressing my needs in the wrong way Anyways, getting this expression I'm doing here as a first class member might be a good idea, as it seems to be a thing multiple templates does (basically, a method/property/something that returns true if there is only a single top level entry). I don't know what the Alternatively, provide some way of getting the children of the first entry if it's a single top leve, and the whole thing if not, as a convenience. |
Sometimes it helps to understand what you are actually trying to accomplish. Now your request is more clear. Regardless, my proposed fix above will address your needs. |
This could be useful in templates. Fixes mkdocs#1325.
This could be useful in templates. Fixes mkdocs#1325.
This could be useful in templates. Fixes #1325.
Currently, you can only iter over
TableOfContents
. I would like to know the length of it.The text was updated successfully, but these errors were encountered: