vsajip / sphinx_sizzle_theme

This is a theme for Sphinx. It was inspired by the Guzzle theme, but has diverged quite a bit.
https://docs.red-dove.com/sphinx_sizzle_theme/
Other
4 stars 1 forks source link

toctree highlighting when some page in subdirectory. #5

Closed vsajip closed 5 years ago

vsajip commented 5 years ago

Original report by Indian Sunset (Bitbucket: idnsunset, GitHub: idnsunset).


When subdirectories are used for a project, supposing the source directory structure as below:

source
   |_____ index.rst
   |_____ doc1.rst
   |_____ subdir
            |______ index.rst
            |______ doc2.rst

Contents of index.rst:

Top Index
---------

.. toctree::

   index
   subdir/index

Contents of subdir/index.rst:

Subdir Index

.. toctree::

   doc2.rst

The global TOC generated in doc2.html would be like:

...
<li class="toctree-l1 current">
  <a class="reference internal" href="index.html">Subdir Index</a>
  <ul class="current">
    <li class="toctree-l2 current">
      <a class="current reference internal" href="#subdir-index">Subdir Index</a>
    </li>
      <ul>
        <li class="toctree-l3">
          <a class="current reference internal href="#doc2-title">Doc2 Title</a>
        </li>
      </ul>
  </ul>
</li>

Please notice class attribute current in <li> and <a> tag for current document (subdir/doc2.html) and it;s parent (subdir/index.html). When you are at subdir/doc2.html, the title link of both subdir/doc2.html and subdir/index.html in TOC get highlighted as sizzle.css defines:

.sidebar-toc ul li.current &amp;amp;gt; a {
    background-color: #e6e6e6;
    color: #444;
}

I think you want highlight toctree-l1 only, right? If true, some modification needed here.

vsajip commented 5 years ago

Fixed #5: Updated style to only highlight level 1 TOC entries.

vsajip commented 5 years ago

This bit is the same as the original Guzzle theme, IIRC. You're suggesting to change the selector part from li.current to li.toctree-l1.current, right? Not sure if it’s actively bad the way it is.

vsajip commented 5 years ago

Original changes by Vinay Sajip (Bitbucket: vinay.sajip, GitHub: vsajip).


changed state from "new" to "resolved"