Add fragment links to sub-headers in docs (fixes #61)

Allows users to copy links to sub-headers within docs.
This commit is contained in:
Ian Lewis
2019-06-26 13:15:57 +08:00
committed by Ian Lewis
parent 8d8380564f
commit 8e6c43e5c5
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -72,3 +72,10 @@ a.doc-table-anchor {
.td-default main section.td-cover-block p.lead strong {
font-weight: bold;
}
.td-page,.td-section {
main a.header-link {
color: inherit;
font-size: 60%;
}
}
+7
View File
@@ -10,3 +10,10 @@
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{ end }}
{{ partial "hooks/body-end.html" . }}
<script type="text/javascript">
$("body.td-page,body.td-section").find("main h2,h3,h4").each(function() {
var fragment = $(this).attr('id');
$(this).append('&nbsp;<a href="#'+fragment+'" class="header-link"><i class="fas fa-link"></i></a>');
});
</script>