bep / docuapi

Beautiful multilingual API documentation theme for Hugo
https://docuapi.netlify.app/
Other
750 stars 200 forks source link

TOC not rendering all headers #70

Closed flumonion closed 3 years ago

flumonion commented 3 years ago

Hi,

I am a bit confused as to how the TOC rendering works. Should not all headings be rendered to TOC up to depth maxMenuDepth?

Here are some examples.

my config.toml has

maxMenuDepth = 3

Example 1:

---
weight: 10
title: Test
---

# h-1 

## h-1-1

Renders (only showing relevant bits of html)

<li>h-1</li>

Example 2:

---
weight: 10
title: Test
---

# h-1 

## h-1-1

### h-1-1-1

Renders

<li>h-1</li>

Example 3.

---
weight: 10
title: Test
---

# h-1 

## h-1-1

### h-1-1-1

## h-1-2

Renders

<li>
    h-1
    <ul>
        <li>
            h-1-1
            <ul>
                <li>
                    h-1-1-1
                </li>
            </ul>
        </li>
    </ul>
</li>

Or, am I misunderstanding the feature...

It looks to me as if level 2 is not rendered in all cases.

Same applies if I set

maxMenuDepth = 2

By the way, thanks for the great theme!

bep commented 3 years ago

@@khos2ow implemented the maxMenuDepth setting. It looked correct to me at that time, but I have not tested it extensively.

khos2ow commented 3 years ago

I just tested it out and it's basically working as expected 99% of times except when the last h1 of the TOC contains any children (or grandchildren for that matter). That's the reason in your Example 3 everything is there except h-1-2 (the same for other examples as well).

khos2ow commented 3 years ago

I'll send a PR soon.