-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ ENH: Make starting depth of sidebar configurable in generated html (#…
…309)
- Loading branch information
1 parent
89d3885
commit e916043
Showing
19 changed files
with
203 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> | ||
<div class="bd-toc-item active"> | ||
<ul class="nav bd-sidenav"> | ||
{{ generate_nav_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }} | ||
</ul> | ||
{{ generate_nav_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }} | ||
</div> | ||
</nav> |
10 changes: 10 additions & 0 deletions
10
tests/sites/sidebars/_templates_sidebar_level2/sidebar-nav-bs.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> | ||
<div class="bd-toc-item active"> | ||
<!-- Use deeper level for sidebar --> | ||
{% if pagename.startswith("section1/subsection1") %} | ||
{{ generate_nav_html("sidebar", startdepth=2, maxdepth=4, collapse=True, includehidden=True, titles_only=True) }} | ||
{% else %} | ||
{{ generate_nav_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }} | ||
{% endif %} | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% extends "pydata_sphinx_theme/layout.html" %} | ||
|
||
{# Silence the navbar #} | ||
{% block docs_navbar %} | ||
{% endblock %} |
6 changes: 6 additions & 0 deletions
6
tests/sites/sidebars/_templates_single_sidebar/sidebar-nav-bs.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> | ||
<div class="bd-toc-item active"> | ||
<!-- Specify a startdepth of 0 instead of default of 1 --> | ||
{{ generate_nav_html("sidebar", startdepth=0, maxdepth=4, collapse=True, includehidden=True, titles_only=True) }} | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "PyData Tests" | ||
copyright = "2020, Pydata community" | ||
author = "Pydata community" | ||
|
||
master_doc = "index" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
html_theme = "pydata_sphinx_theme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Sidebar depth variations | ||
======================== | ||
|
||
.. toctree:: | ||
:caption: Caption 1 | ||
|
||
section1/index | ||
|
||
|
||
.. toctree:: | ||
:caption: Caption 2 | ||
|
||
section2/index | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Section 1 index | ||
=============== | ||
|
||
.. toctree:: | ||
:caption: Section 1 | ||
|
||
subsection1/index | ||
page2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Section 1 page 1 | ||
================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Subsection 1.1 index | ||
==================== | ||
|
||
.. toctree:: | ||
:caption: Subsection 1.1 | ||
|
||
page1 | ||
page2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Section 1 sub 1 page 1 | ||
====================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Section 1 sub 1 page 2 | ||
====================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Section 2 index | ||
=============== | ||
|
||
.. toctree:: | ||
|
||
page1 | ||
https://google.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Section 1 Page 1 | ||
================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<nav aria-label="Main navigation" class="bd-links" id="bd-docs-nav"> | ||
<div class="bd-toc-item active"> | ||
<ul class="nav bd-sidenav"> | ||
<li class="toctree-l2"> | ||
<a class="reference internal" href="subsection1/index.html"> | ||
Subsection 1.1 index | ||
</a> | ||
</li> | ||
<li class="toctree-l2"> | ||
<a class="reference internal" href="page2.html"> | ||
Section 1 page 1 | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<nav aria-label="Main navigation" class="bd-links" id="bd-docs-nav"> | ||
<div class="bd-toc-item active"> | ||
<!-- Use deeper level for sidebar --> | ||
<ul class="nav bd-sidenav"> | ||
<li class="toctree-l3"> | ||
<a class="reference internal" href="page1.html"> | ||
Section 1 sub 1 page 1 | ||
</a> | ||
</li> | ||
<li class="toctree-l3"> | ||
<a class="reference internal" href="page2.html"> | ||
Section 1 sub 1 page 2 | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<nav aria-label="Main navigation" class="bd-links" id="bd-docs-nav"> | ||
<div class="bd-toc-item active"> | ||
<!-- Specify a startdepth of 0 instead of default of 1 --> | ||
<p class="caption"> | ||
<span class="caption-text"> | ||
Caption 1 | ||
</span> | ||
</p> | ||
<ul class="nav bd-sidenav"> | ||
<li class="toctree-l1"> | ||
<a class="reference internal" href="section1/index.html"> | ||
Section 1 index | ||
</a> | ||
</li> | ||
</ul> | ||
<p class="caption"> | ||
<span class="caption-text"> | ||
Caption 2 | ||
</span> | ||
</p> | ||
<ul class="nav bd-sidenav"> | ||
<li class="toctree-l1"> | ||
<a class="reference internal" href="section2/index.html"> | ||
Section 2 index | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> |