Skip to content Skip to sidebar Skip to footer

Can I Add A Horizontal Bar To A Table Of Contents In Sphinx?

I'm developing documentation in Sphinx, and would like to separate sections in my table of contents using horizontal bars. I often see this in menus: Is there a way to do it in sp

Solution 1:

The python sphinx .. toctree:: directive doesn't allow much variation besides the documents you include in the directive body, plus a few directive options.

What I've seen others do in this case is splitting one toctree into several, including reStructuredText in between them.

You could use an alternative to the toctree. Quoting the documentation:

Note

For local tables of contents, use the standard reST contents directive.

The easiest way is splitting the menu into several toctrees including a HTML horizontal ruler between them:

Sphinx_test
===========


.. toctree::
   :maxdepth: 4
   
   undo
   redo

.. raw:: html

   <hr>

.. toctree::
   :maxdepth: 4
   
   cut
   copy

.. raw:: html

   <hr>
   
.. toctree::
   :maxdepth: 4
      
   find
   Speech

And the result:

enter image description here

Post a Comment for "Can I Add A Horizontal Bar To A Table Of Contents In Sphinx?"