oprypin / mkdocs-literate-nav

MkDocs plugin to specify the navigation in Markdown instead of YAML
https://oprypin.github.io/mkdocs-literate-nav
MIT License
73 stars 8 forks source link

No easy way to hide single directory #5

Open jaklan opened 2 years ago

jaklan commented 2 years ago

In mkdocs-awesome-pages, we have two ways to exclude a directory: 1) we can put a .pages file in the folder with hide: true 2) in the parent folder, we can put a .pages file like:

nav:
  - ... | *.md
  - another-subdir-to-include

To get sth similar with mkdocs-literate-nav, we need to create a SUMMARY.md file like:

- *.md
- [Another subdir to include](another-subdir-to-include/)

This doesn't work:

- *.md
- another-subdir-to-include/

Error:

The problematic item:

<li>another-subdir-to-include/</li>

Afaik - there's no equivalent of hide: true, and also writing a sub-dir nav is not as smooth, because you need to specify all the titles for sub-dirs you want to include, which is quite redundant.

jaklan commented 2 years ago

I see there's some workaround:

- *.md
- another-sub*dir-to-include/

This actually works. Note the asterisk - it can be placed in whatever place. But anyway, it should also work without it, because using the asterisk can lead to some unexpected results (imagine you have such folders: subdir, subsubdir, subdir2 and you want to include only subdir: all combinations like sub*dir/, subdir*/ *subdir/ would fail).

oprypin commented 2 years ago

It seems that this report boils down to the overall fact that mkdocs-literate-nav simply doesn't let you omit the title of anything. The overall philosophy is that the literate nav remains as a readable Markdown document itself, and that's also the original rationale. But yes, with the whole thing with wildcards being available, that philosophy isn't satisfiable anymore anyway, so maybe this can be reconsidered.