TOC refinements

This commit is contained in:
2026-05-07 18:56:00 +02:00
parent cc264daa79
commit a18f991c0b
4 changed files with 21 additions and 15 deletions
+7 -1
View File
@@ -1,5 +1,11 @@
(function () { (function () {
document.querySelectorAll('.content h1, .content h2, .content h3, .content h4, .content h5, .content h6').forEach(function (h) { var content = document.querySelector("main");
if (!content) return;
var headings = content.querySelectorAll("h2, h3, h4");
if (!headings) return
headings.forEach(function (h) {
if (!h.id) return; if (!h.id) return;
var a = document.createElement('a'); var a = document.createElement('a');
a.href = '#' + h.id; a.href = '#' + h.id;
+1 -1
View File
@@ -32,7 +32,7 @@
{{block "content" .}}{{end}} {{block "content" .}}{{end}}
</main> </main>
<footer> <footer>
<span class="muted">Request time: {{.RenderMS}} ms</span> <span class="muted">Request: {{.RenderMS}} ms</span>
{{block "footerExtras" .}}{{end}} {{block "footerExtras" .}}{{end}}
</footer> </footer>
{{block "extras" .}}{{end}} {{block "extras" .}}{{end}}
+4 -4
View File
@@ -238,12 +238,12 @@ main {
max-width: 100%; max-width: 100%;
} }
.content a.heading-anchor { a.heading-anchor {
color: var(--text-muted); color: var(--text-muted);
margin-right: 0.4em; margin-right: 0.4em;
font-weight: normal; font-weight: normal;
} }
.content a.heading-anchor:hover { a.heading-anchor:hover {
color: var(--primary-hover); color: var(--primary-hover);
} }
@@ -550,10 +550,10 @@ hr {
color: var(--link-hover); color: var(--link-hover);
} }
.toc-h2 { .toc-h3 {
padding-left: 0.8rem; padding-left: 0.8rem;
} }
.toc-h3 { .toc-h4 {
padding-left: 1.6rem; padding-left: 1.6rem;
} }
+1 -1
View File
@@ -2,7 +2,7 @@
var content = document.querySelector("main"); var content = document.querySelector("main");
if (!content) return; if (!content) return;
var headings = content.querySelectorAll("h1, h2, h3"); var headings = content.querySelectorAll("h2, h3, h4");
if (headings.length < 2) return; if (headings.length < 2) return;
var nav = document.createElement("nav"); var nav = document.createElement("nav");