Skip to content

Commit

Permalink
Add fragment links to sub-headers in docs (fixes google#61)
Browse files Browse the repository at this point in the history
Allows users to copy links to sub-headers within docs.
  • Loading branch information
ianlewis committed Jun 26, 2019
1 parent 8d83805 commit 8e6c43e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/scss/_styles_project.scss
Expand Up @@ -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 changes: 7 additions & 0 deletions layouts/partials/scripts.html
Expand Up @@ -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>

0 comments on commit 8e6c43e

Please sign in to comment.