try0 / mkdocs-toc-md

mkdocs-toc-md is an mkdocs plugin that generates a toc (table of contents) as markdown. Writes toc to index.md. 目次を生成します。

Home Page:https://try0.github.io/mkdocs-toc-md/sample/site/mkdocs-toc-md.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow the table of contents output process to be extended

try0 opened this issue · comments

Hello

Continuing conversation of the previous issue.

Yes, different users may want to customize the way toc is computed in different ways so best is to make it configurable.

Bear in mind that the more configuration one includes, more difficult is to jump start, which eventually leads to less people understanding and using it.

So best is to look at this as an advanced feature and provide a good default.

Kind Regards

commented

Hi. I have released v0.0.7.

shift_header: after_h1_of_index

Sample

Try it!

Hi

Looking better.
I see 1 issue though.
When you have the following structure:

├── docs
│   ├── Home
│   │   ├── index.pt.md
│   │   ├── index.en.md
│   │   ├── subdirectory1
│   │   │    ├── index.pt.md
│   │   │    ├── index.en.md
│   ├── index.pt.md
│   ├── index.en.md
│   ├── mkdocs.yml

The page title of subdirectory1/index.*.md is rendering as h2. Since it is in a subdirectory, there should be some difference.

Also, can we make items collapsable/expandable?

Maybe it would help if you set a configuration variable to use with mkdocs-awesome-pages:
https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin

This supports the addition of a file named ".pages" per directory which has the navigation configuration like the following:

nav:
    - Home: Home
    - User Documentation: UserDocumentation
    - APIs & Interfaces: APIsInterfaces
    - Script Development: ScriptDevelopment
    - Models

Thanks!

Some photos for better understanding:
image

image

commented

there should be some difference.

I agree.
Currently, the table of contents is generated based on flat nav.pages. I will improve it to use nav.items to consider hierarchy.
Thanks

Also, can we make items collapsable/expandable?

I don't know if I can implement it, but I'll try.

Hello. Any updates on this?

commented

Hello.

I agree.
Currently, the table of contents is generated based on flat nav.pages. I will improve it to use nav.items to consider hierarchy.

I have finished the first task.
For the time being, I'll release it.
Please wait a little while.

commented

I just released v0.0.8.

Hello
Which configuration params should i include to solve this issue?

Thanks

commented

The default value for the output behaviour is to take the navigation hierarchy into account,
so no changes to the configuration file should be necessary.