Open jaklan opened 2 years ago
Thanks for the report. Indeed I can exactly reproduce this in a test:
tests/nav/whatever.yml
files:
SUMMARY.md: |
- *.md
- docs/*
file.md:
docs/SUMMARY.md: |
- *.md
docs/some-file.md:
docs/dir/another-file.md:
output:
- null: file.md
- null: docs/SUMMARY.md
- null: docs/some-file.md
- Dir:
- null: docs/dir/another-file.md
pytest -sv --update-goldens
And indeed it seems like your expectation for this makes more sense.
No, wait...
I guess it's because we have two SUMMARY.md files in the same dir and only the first one is read.
That is not correct. Wildcards can't actually pull in a nav file.
- *.md
- docs/*
This nav is equivalent to
- *.md
- docs/*.md
- docs/*/
Which is
Which then gets expanded as
@oprypin Okay, so than we have 3 scenarios here:
1) the above one with docs/*
- we pull in all .md
files and all subdirs, docs/SUMMARY.md
is treated just as a normal .md
file, not the nav one
2) the one with docs/*.md
- we pull in all .md
files, docs/SUMMARY.md
is treated just as a normal .md
file, not the nav one
3) the one with docs/
- we pull in files and subdirs specified in docs/SUMMARY.md
, which is treated as a nav file, but we need to explicitly specify the section name, e.g. - [Docs](docs/)
The last behaviour is exactly what I want to achieve, but then we just encounter the issue I mentioned in #5. And as you commented there - even if it was the part of the initial philosophy not to omit titles, wildcards change that assumption significantly. And tbh - it's much more convenient, so if we allow such syntax in a nav file: - docs/
and auto-generate title then - we would solve both issues easily.
One more note to the above comment - I mentioned The last behaviour is exactly what I want to achieve - of course that's not actually true, because there's no flattening in that variant. Sorry, it was late 😉
In result neither option provides what I need - I can either flatten the structure but with no way to control the sub-nav or... I can control the sub-nav with no way to flatten the structure.
Let's say we have such a structure:
In
project/SUMMARY.md
we have:In
project/docs/SUMMARY.md
we have:In result I would expect to get such nav:
But what I get is:
I guess it's because we have two
SUMMARY.md
files in the same dir and only the first one is read. But I would expectSUMMARY.md
are read from the deepest dirs first and only the result structure of the defined filter is merged to the higher ones.