TOC refinements
This commit is contained in:
+15
-9
@@ -1,11 +1,17 @@
|
||||
(function () {
|
||||
document.querySelectorAll('.content h1, .content h2, .content h3, .content h4, .content h5, .content h6').forEach(function (h) {
|
||||
if (!h.id) return;
|
||||
var a = document.createElement('a');
|
||||
a.href = '#' + h.id;
|
||||
a.className = 'heading-anchor';
|
||||
a.setAttribute('aria-label', 'Link to this section');
|
||||
a.textContent = '#';
|
||||
h.insertBefore(a, h.firstChild);
|
||||
});
|
||||
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;
|
||||
var a = document.createElement('a');
|
||||
a.href = '#' + h.id;
|
||||
a.className = 'heading-anchor';
|
||||
a.setAttribute('aria-label', 'Link to this section');
|
||||
a.textContent = '#';
|
||||
h.insertBefore(a, h.firstChild);
|
||||
});
|
||||
}());
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
{{block "content" .}}{{end}}
|
||||
</main>
|
||||
<footer>
|
||||
<span class="muted">Request time: {{.RenderMS}} ms</span>
|
||||
<span class="muted">Request: {{.RenderMS}} ms</span>
|
||||
{{block "footerExtras" .}}{{end}}
|
||||
</footer>
|
||||
{{block "extras" .}}{{end}}
|
||||
|
||||
+4
-4
@@ -238,12 +238,12 @@ main {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.content a.heading-anchor {
|
||||
a.heading-anchor {
|
||||
color: var(--text-muted);
|
||||
margin-right: 0.4em;
|
||||
font-weight: normal;
|
||||
}
|
||||
.content a.heading-anchor:hover {
|
||||
a.heading-anchor:hover {
|
||||
color: var(--primary-hover);
|
||||
}
|
||||
|
||||
@@ -550,10 +550,10 @@ hr {
|
||||
color: var(--link-hover);
|
||||
}
|
||||
|
||||
.toc-h2 {
|
||||
.toc-h3 {
|
||||
padding-left: 0.8rem;
|
||||
}
|
||||
.toc-h3 {
|
||||
.toc-h4 {
|
||||
padding-left: 1.6rem;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
var content = document.querySelector("main");
|
||||
if (!content) return;
|
||||
|
||||
var headings = content.querySelectorAll("h1, h2, h3");
|
||||
var headings = content.querySelectorAll("h2, h3, h4");
|
||||
if (headings.length < 2) return;
|
||||
|
||||
var nav = document.createElement("nav");
|
||||
|
||||
Reference in New Issue
Block a user