From ffc27f24945d01738df902b84fbb7abb9eb2ac09 Mon Sep 17 00:00:00 2001 From: "Hasko, Vladimir" Date: Thu, 23 Feb 2023 11:56:31 +0000 Subject: [PATCH] changing css and template to better visualize sidebar Reviewed-by: tischrei Co-authored-by: Hasko, Vladimir Co-committed-by: Hasko, Vladimir --- doc/source/_static/css/default.css | 9 +++++++++ doc/source/templates/sidebartoc.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/source/_static/css/default.css b/doc/source/_static/css/default.css index 9bdd539..e1a0986 100644 --- a/doc/source/_static/css/default.css +++ b/doc/source/_static/css/default.css @@ -47,3 +47,12 @@ .navigator-container .card li { padding: 0.2rem 1rem; } + +/* A "nice" workaround to let us keep l2 level permanently open + * but hide child ul's not underneath current selection. + * The only eventually open issue is that this way the whole child tree is + * open including all subtrees. + */ +.docs-sidebar-toc li.toctree-l2:not(.current) > ul { + display: none; +} diff --git a/doc/source/templates/sidebartoc.html b/doc/source/templates/sidebartoc.html index 80a0099..9c5b945 100644 --- a/doc/source/templates/sidebartoc.html +++ b/doc/source/templates/sidebartoc.html @@ -6,7 +6,7 @@ {%- if theme_sidebar_mode == 'toc' %} {{ toc }} {%- elif theme_sidebar_mode == 'toctree' %} - {{ toctree(maxdepth=2,includehidden=True, collapse=False) }} + {{ toctree(maxdepth=3, includehidden=True, collapse=False, titles_only=True) }} {%- endif %} {%- endif %}