-
Notifications
You must be signed in to change notification settings - Fork 37
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
[FEATURE] flat n
- How to include nested folders correctly?
#99
Comments
flat n
- How to include nested folders correctly?
You can try this example here: https://github.com/VladimirFokow/example_for_issue99 |
maybe this is related? #53 (comment) |
If I understood correctly, you just want to re-order the top-level sections/directories. In that case, this should do the trick: nav:
- topicA
- ... |
thanks for the reply @lukasgeiter ! Unfortunately your suggestion doesn't work at all... Instead, this would put nav:
- ... | topicA/**
- ... But it's not flexible enough. I think it's currently impossible to do all of this at once:
|
It works, if you place it in |
ah, I see; added this approach to the example repo |
Please advise me on the correct way to solve this issue. 🙏
If impossible - I suggest a feature that would solve it.
I think it's currently impossible to do all of this at once:
index.md
page (that the users automatically start on) be inside of topic A nav sectionLet's say we have the following structure of our docs:
topicA
,c_topic
,b_topic
, etc.)I want to have "TOPIC A" like this, and let everything else stay automatic.
(I'm using Material's navigation tabs)
Concrete use case:
What I've tried and why there is a problem:
mkdocs.yml
has:then "TOPIC A" isn't the first in order. But it has all the desired sub-structure.
If
mkdocs.yml
has:then there is an unnecessary "topicA" folder:
Trying to address the problem in attempt 1 - to remove the unnecessary folder, we can try adding
flat
:but then topic A loses all of its subdirectories:
You can set the order of topics like this (and their sub-folder structure will be preserved ( 🎉) :
BUT then:
This workaround is too manual and unacceptable. Here is how:
Move all the sub-folders out to the top level, and specify each of them manually.
Change the file structure to this:
Then
mkdocs.yml
can be like this:Is this the only way?...
An idea how this should be achieved (if there are no better methods) :
add an optional parameter
n
toflat
:flat n
n > 0
: leave a max. ofn
nesting levels in the endn < 0
: remove a max. ofabs(n)
outer nesting levels(The default behavior with no parameter is
n=1
)(
n=0
is interpreted asn=1
)(I say max. in case there are not enough nesting layers to leave / remove)
For example,
flat 1
-- the resulting folder has max. 1 nesting levelflat 2
-- the resulting folder has max. 2 nesting levelsflat -1
-- the resulting folder has all the nesting levels except the outer-most oneflat -2
-- the resulting folder has all the nesting levels except the outer-most two...
So the problem above can be solved with:
mkdocs.yml
has:Would result in:
(desired example with
index.md
also included)The text was updated successfully, but these errors were encountered: