From c97685a94022a2e826f644e1f62e9976d5d62544 Mon Sep 17 00:00:00 2001 From: "Nicholas S. Husin" Date: Fri, 2 Jan 2026 16:35:19 -0500 Subject: _content/js: do not use indented subheading to start the 2nd column of a TOC Currently, the entries for our generated TOC are split across two columns without regards on whether an entry is a regular heading vs an indented subheading. As a result, it is possible for the 2nd column of our generated TOC to start with an indented subheading, which is visually confusing and hard to associate with the last regular heading in the 1st column. This CL changes our TOC generation so that any indented subheadings will always be placed in the same column as its parent heading. Fixes golang/go#76980 Change-Id: I8f5ae689ae9fc70da856b198f5453e18d692780d Reviewed-on: https://go-review.googlesource.com/c/website/+/733720 LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Reviewed-by: Nicholas Husin Reviewed-by: Dmitri Shuralyov --- _content/js/godocs.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_content/js/godocs.js b/_content/js/godocs.js index c32acc86..ee00be36 100644 --- a/_content/js/godocs.js +++ b/_content/js/godocs.js @@ -72,6 +72,11 @@ for (var i = 0; i < split_index; i++) { dl1.append(toc_items[i]); } + // Do not start the 2nd column with indented subheadings, which can be + // visually confusing. + for (; i < toc_items.length && toc_items[i].hasClass("indent"); i++) { + dl1.append(toc_items[i]); + } for (; /* keep using i */ i < toc_items.length; i++) { dl2.append(toc_items[i]); } -- cgit v1.3