Skip to content
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

Support empty first item, to create section contents? #31

Open
pawamoy opened this issue May 15, 2024 · 3 comments
Open

Support empty first item, to create section contents? #31

pawamoy opened this issue May 15, 2024 · 3 comments

Comments

@pawamoy
Copy link

pawamoy commented May 15, 2024

Without literate-nav, I do this in nav:

    - Layouts:
      - manual/commands/api/layouts/index.md
      - Bsp: manual/commands/api/layouts/bsp.md
      - Columns: manual/commands/api/layouts/columns.md

(I use your section-index plugin)

How would I go about doing the same with literate-nav and gen-files?

If I do the following:

    - Layouts: manual/commands/api/layouts/

...and write this SUMMARY.md manually:

* [](index.md)
* [Bsp](bsp.md)
* [Columns](columns.md)

...it works. But I don't think I can programmatically create such a literate nav with gen-files:

nav = mkdocs_gen_files.Nav()

nav[()] = "index.md"  # error
nav[""] = "index.md"  # error
@pawamoy pawamoy mentioned this issue May 15, 2024
9 tasks
@oprypin
Copy link
Owner

oprypin commented May 15, 2024

The solution in mkdocs_literate_nav for this is:

  • Omit index.md. Write this SUMMARY.md:

    * [Bsp](bsp.md)
    * [Columns](columns.md)
  • Specify implicit_index.

    plugins:
      - literate-nav:
          nav_file: SUMMARY.md
          implicit_index: true

Bonus style points for actual literate nav:

  • plugins:
      - literate-nav:
          nav_file: index.md
          implicit_index: true
  • Write this index.md manually:

    # Layout objects
    
    Layouts position windows according to x x x
    
    These are the available layout objects:
    
    <!--nav-->
     * [Bsp](bsp.md)
     * [Columns](columns.md)

@oprypin
Copy link
Owner

oprypin commented May 15, 2024

To support this workaround in mkdocs-gen-files, this would be the code change:
d6f08a1

@pawamoy
Copy link
Author

pawamoy commented May 15, 2024

implicit_index: true

Awesome, I missed this option in the docs, sorry!

This option solves my use-case, so the change in mkdocs-gen-files is not critical (but could allow per-summary configuration instead of only global configuration 👍).

Thanks @oprypin.

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

No branches or pull requests

2 participants