mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-29 02:48:32 +07:00
Add nested navigation to the ReadTheDocs theme
This commit is contained in:
@@ -57,7 +57,11 @@
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
{% include "toc.html" %}
|
||||
<ul class="current">
|
||||
{% for nav_item in nav %}
|
||||
<li>{% include "toc.html" %}<li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
@@ -25,7 +25,7 @@ h3, h4, h5, h6 {
|
||||
color: #838383;
|
||||
}
|
||||
|
||||
.wy-menu-vertical .toctree-l2 a {
|
||||
.wy-menu-vertical .subnav a {
|
||||
padding: 0.4045em 2.427em;
|
||||
}
|
||||
|
||||
@@ -116,3 +116,11 @@ code.cs, code.c {
|
||||
padding: 6px 12px;
|
||||
border-color: #D1D4D5;
|
||||
}
|
||||
|
||||
.wy-menu-vertical li ul {
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
.wy-menu-vertical li ul.subnav ul.subnav{
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
@@ -1,38 +1,23 @@
|
||||
<ul class="current">
|
||||
{% for nav_item in nav %}
|
||||
{% if nav_item.children %}
|
||||
<span>{{ nav_item.title }}</span>
|
||||
{% for nav_item in nav_item.children %}
|
||||
<li class="toctree-l2 {% if nav_item.active%}current{%endif%}">
|
||||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
{% if nav_item == current_page %}
|
||||
<ul>
|
||||
{% for toc_item in toc %}
|
||||
<li class="toctree-l3"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in toc_item.children %}
|
||||
<li><a class="toctree-l4" href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% if nav_item.children %}
|
||||
<ul class="subnav">
|
||||
<li><span>{{ nav_item.title }}</span></li>
|
||||
|
||||
{% for nav_item in nav_item.children %}
|
||||
{% include 'toc.html' %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<li class="toctree-l1 {% if nav_item.active%}current{%endif%}">
|
||||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
{% if nav_item == current_page %}
|
||||
<ul>
|
||||
{% for toc_item in toc %}
|
||||
<li class="toctree-l3"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in toc_item.children %}
|
||||
<li><a class="toctree-l4" href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<li class="toctree-l1 {% if nav_item.active%}current{%endif%}">
|
||||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
{% if nav_item == current_page %}
|
||||
<ul>
|
||||
{% for toc_item in toc %}
|
||||
<li class="toctree-l3"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in toc_item.children %}
|
||||
<li><a class="toctree-l4" href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user