guzzle / guzzle_sphinx_theme

Sphinx theme used by Guzzle
MIT License
170 stars 60 forks source link

CSS should support TOC hierarchy expressed as (class-less) HTML hierarchy #31

Open smiley opened 6 years ago

smiley commented 6 years ago

Guzzle theme's CSS relies on your table of contents to have .toctree-l1, .toctree-l2, .toctree-l3 classes to express hierarchy. For some reason our Sphinx setup didn't generate these classes, but it did express it via simple HTML hierarchy:

<div class="sidebar-toc">
    <ul>
        <li><a class="reference internal" href="#">helplib.base</a>
            <ul>
                <li><a class="reference internal" href="#intro">Intro</a></li>
                <li><a class="reference internal" href="#types">Types</a></li>
                <li><a class="reference internal" href="#functions">Functions</a></li>
            </ul>
        </li>
    </ul>    
</div>

Thus, I added a CSS3 child selector in addition to the existing class selector: (which both our HTML and Guzzle's docs' matches)

.sidebar-toc ul li.toctree-l2 a,
.sidebar-toc > ul > li > ul > li > a {
  padding: 5px 50px;
}