From e27ebb5dff38aad9fbaa3d957820a1bd3c8d3bbf Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Thu, 3 Feb 2022 22:50:32 -0800 Subject: [PATCH] Linkify sidebar headings for sibling items Also adjust CSS so this doesn't produce excess padding/margin. --- src/librustdoc/html/static/css/rustdoc.css | 3 +- src/librustdoc/html/static/js/main.js | 40 +++++++++++++--------- src/test/rustdoc-gui/sidebar-mobile.goml | 2 +- src/test/rustdoc-gui/sidebar.goml | 7 ++++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index a431bb63f63e0..b28c8766f8a8c 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -472,6 +472,7 @@ nav.sub { } .block ul, .block li { padding: 0; + margin: 0; list-style: none; } @@ -502,8 +503,6 @@ nav.sub { font-weight: 500; padding: 0; margin: 0; - margin-top: 0.5rem; - margin-bottom: 0.25rem; } .sidebar-links, diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index cab3c28342dab..8e1919f75d671 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -559,7 +559,15 @@ function hideThemeButtonState() { others.appendChild(div); } - function block(shortty, longty) { + /** + * Append to the sidebar a "block" of links - a heading along with a list (`