Skip to content

Commit 7e6bf77

Browse files
author
saowang
committed
Add content anchor link
1 parent fb0184f commit 7e6bf77

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

_sass/_icons.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@
5555
.fa-exclamation-circle:before {
5656
content: "\f06a";
5757
}
58+
59+
// content
60+
.fa-link:before {
61+
content: "\f0c1";
62+
}

_sass/class/markdown-body.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
}
5050
}
5151

52+
.anchor {
53+
padding-right: 0;
54+
margin-left: -15px;
55+
}
5256
.highlight pre,
5357
pre {
5458
font-size: $font-size-small;

assets/js/theme.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ $(".toc ul")
267267
link.prepend(expand);
268268
});
269269

270+
$(".markdown-body :header").prepend(function () {
271+
return `<a href="#${this.id}" class="anchor"><i class="octicon-link fa fa-link text-blue"></i></a>`;
272+
});
273+
270274
if ("serviceWorker" in navigator) {
271275
navigator.serviceWorker.register(`${ui.baseurl}/sw.caches.js`);
272276
} else {

0 commit comments

Comments
 (0)