Update Headline rendering
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}());
|
||||
@@ -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}}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
if (h.querySelector('a.btn')) return;
|
||||
var a = document.createElement('a');
|
||||
a.href = '?edit§ion=' + (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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user