I had a similar problem and i used a mixed of self defined roles and jQuery to adjust this issues based on my role placement. jQuery will change all the stuff y need.
Change Sphinx's template for table of contents
-
01-07-2022 - |
Question
I am using Sphinx with my own template to get a documentation style like the twitter bootstrap documentation: http://getbootstrap.com/2.3.2/getting-started.html
There you can see the navigation on the left, which is static and stays at the same place as you scroll.
It is therefore nescessary to render the table of contents which I already achieved with this function:
{{ toctree(maxdepth=1, collapse=False, includehidden=true) }}
That outputs me the following:
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="#roadmap">Roadmap</a></li>
</ul>
But in order to let it work with bootstrap I need the following output:
<ul class="nav nav-list bs-docs-sidenav">
<li><a href="#introduction"><i class="icon-chevron-right"></i> Introduction</a></li>
<li><a href="#installation"><i class="icon-chevron-right"></i> Installation</a></li>
<li><a href="#roadmap"><i class="icon-chevron-right"></i> Roadmap</a></li>
</ul>
So my question is: How can I achieve that? Is there a template file for the toctree()
function I can adjust?
No correct solution
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow