aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas S. Husin <nsh@golang.org>2026-01-02 16:35:19 -0500
committerNicholas Husin <nsh@golang.org>2026-01-02 15:11:59 -0800
commitc97685a94022a2e826f644e1f62e9976d5d62544 (patch)
tree68300fc6ebd9a092938475c58a715ab56d122329
parent94286c9833eaa5e462a2d6363ff307224fd46f83 (diff)
downloadgo-x-website-c97685a94022a2e826f644e1f62e9976d5d62544.tar.xz
_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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
-rw-r--r--_content/js/godocs.js5
1 files changed, 5 insertions, 0 deletions
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]);
}