Ellerbach / docfx-companion-tools

A suite of tools, pipelines templates to take the very best of DocFX
MIT License
64 stars 18 forks source link

TocGenerator creates pointless/duplicate table items. #52

Open alanSherba opened 5 months ago

alanSherba commented 5 months ago

When generating toc's with the following params:

 -s -r -m 1 -g -v -i

The TOC's that get generated will contain duplicate entries for a folders index.md

With the following folder structure:

 > docs
     - index.md
     > manual
          - index.md
          > folderA
              - index.md
              - example1.md
              - example2.md
          > folderB
              - index.md
              - example.md

I get the following toc.yml in the manual folder:

items:
- name: Manual
  href: index.md
- name: FolderA
  href: FolderA/index.md
  items:
  - name: FolderA                <------ POINTLESS!
    href: FolderA/index.md       <------ POINTLESS!
  - name: Example 1
    href: FolderA/example1.md
  - name: Example 2
    href: FolderA/example2.md
- name: FolderB
  href: FolderB/index.md
  items:
  - name: FolderB
    href: FolderB/index.md
  - name: Example
    href: FolderB/example.md

When I build this the problem becomes more obvious. Index files are essentially listed twice. Once as the "foldout" then again as an item inside the foldout: image

If I delete the duplicate items in the toc.yml's and re-build it all works correctly:

image

Ellerbach commented 5 months ago

if you remove the -i option, you should have the behavior you need if I remember correctly!