Update Headline rendering

This commit is contained in:
2026-08-23 11:36:10 +02:00
parent f78ebe7d5d
commit dddacf9262
6 changed files with 11 additions and 34 deletions
-17
View File
@@ -1,17 +0,0 @@
(function () {
var content = document.querySelector('.content');
if (!content) return;
var headings = content.querySelectorAll('h2, h3, h4');
if (!headings.length) 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
View File
@@ -57,7 +57,6 @@
{{end}}
{{if or .Content .SpecialContent}}
<script src="/_/page/content.js"></script>
<script src="/_/page/anchors.js"></script>
{{if not .SuppressTOC}}<script src="/_/page/toc.js"></script>{{end}}
<script src="/_/page/tasks.js"></script>
{{end}}
+1 -1
View File
@@ -11,7 +11,7 @@
if (h.querySelector('a.btn')) return;
var a = document.createElement('a');
a.href = '?edit&section=' + (i + 1);
a.className = 'btn btn-small';
a.className = 'btn btn-small btn-float';
a.textContent = 'edit';
h.appendChild(document.createTextNode(' '))
h.appendChild(a);
+1 -1
View File
@@ -21,7 +21,7 @@ document.addEventListener("DOMContentLoaded", function () {
var a = document.createElement("a");
a.href = "#" + h.id;
var clone = h.cloneNode(true);
clone.querySelectorAll(".btn, .muted, .heading-anchor, .dropdown").forEach(function (el) { el.remove(); });
clone.querySelectorAll(".btn, .muted, .dropdown").forEach(function (el) { el.remove(); });
a.textContent = clone.textContent.trim();
li.appendChild(a);
list.appendChild(li);