mirror of
https://git.kittycat.homes/zoe/hugo-battheme.git
synced 2024-08-15 03:25:18 +00:00
13 lines
406 B
JavaScript
13 lines
406 B
JavaScript
(function addHeadingLinks() {
|
|
var article = document.getElementById("content");
|
|
var headings = article.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
|
headings.forEach(function (heading) {
|
|
if (heading.id) {
|
|
var a = document.createElement("a");
|
|
a.innerHTML = heading.innerHTML;
|
|
a.href = "#" + heading.id;
|
|
heading.innerHTML = "";
|
|
heading.appendChild(a);
|
|
}
|
|
});
|
|
})();
|