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

Prepare for use with mkdocs-static-i18n

joaolrc opened this issue · comments

First of all, thanks for making this project.. exactly what i was looking for.

What i am about to post is not really an issue but a feature request.

While using mkdocs-static-i18n plugin, one ends with a structure like (assuming pt and en as site languages):

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

So, 2 indexes must be created. One that includes only *.en.md files for en version and another that includes *.pt.md for portuguese version home page.

I already see that you have a feature to erxclude/include filex by pattern/regex.
It would be great that we could combine that and instruct your plugin to create 2 separata index..md to create a home page per language.

Kind Regards!

commented

Hi @joaolrc

Thank you for having an interest in this project.
I don't know if I can do it, but I'll try. 👍

commented

@joaolrc

I have released a v0.0.6 that supports mkdocs-static-i18n.
Could you please check to see if this release satisfies your request?

  1. Update plugin to v0.0.6
  2. Adds setting for mkdocs-static-i18n
      integrate_mkdocs_static_i18n: true
      languages:
        en:
          toc_page_title: Contents
          toc_page_description: Usage mkdocs-toc-md
        ja:
          toc_page_title: 目次
          toc_page_description: mkdocs-toc-mdプラグインの使い方

Sample mkdocs.yml

Hello

Thanks for the quick response and development.
The implementation seems correct!

However, looking at this again, i found another thing that could be better.

Assuming the following structure:

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

If you have an h1 in Home/index and another one in Home/foo, you will render both as H1.
In my opinion, this should not be like that but there may be others that say otherwise.. maybe if you put some config variable to avoid this behaviour, it would be cool.

So, to conclude, you would only render 1 h1 per directory, which should be found at Home/index.
Take as example

Home/index.en.md

# IndexTitle

## IndexSubtitle

Home/foo.en.md

# FooTitle

## FooSubtitle

TOC would look like:

# IndexTitle
### IndexSubtitle
## FooTitle
### FooSubtitle

Do you understand and agree?

Kind Regards

commented

Thanks for checking and the explanation. I understand.
However, I think that each user has a different image of the output they are looking for.
So I will add a function to extend the process of output toc.

Let's move on to #7

Thanks