Skip to content

Commit

Permalink
fix: close mmistakes#4938
Browse files Browse the repository at this point in the history
  • Loading branch information
qddegtya committed Aug 4, 2024
1 parent b0b2698 commit 230f7c0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
34 changes: 19 additions & 15 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,25 @@ $(document).ready(function () {
});

// Add anchors for headings
document
.querySelector(".page__content")
.querySelectorAll("h1, h2, h3, h4, h5, h6")
.forEach(function (element) {
var id = element.getAttribute("id");
if (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML =
'<span class="sr-only">Permalink</span><i class="fas fa-link"></i>';
anchor.title = "Permalink";
element.appendChild(anchor);
}
});
(function () {
var pageContentElement = document.querySelector(".page__content");
if (!pageContentElement) return;

pageContentElement
.querySelectorAll("h1, h2, h3, h4, h5, h6")
.forEach(function (element) {
var id = element.getAttribute("id");
if (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML =
'<span class="sr-only">Permalink</span><i class="fas fa-link"></i>';
anchor.title = "Permalink";
element.appendChild(anchor);
}
});
})();

// Add copy button for <pre> blocks
var copyText = function (text) {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/main.min.js.map

Large diffs are not rendered by default.

0 comments on commit 230f7c0

Please sign in to comment.