diff options
author | Ian Lewis <ianmlewis@gmail.com> | 2019-06-13 22:14:41 -0400 |
---|---|---|
committer | Ian Lewis <ianlewis@google.com> | 2019-06-26 13:15:57 +0800 |
commit | 8e6c43e5c57ffbe6a4c0c11f1e61e2eaa76db52c (patch) | |
tree | b05e896b99da54886dc43629a07be25189101c3b /layouts/partials/scripts.html | |
parent | 8d8380564f8284899183a0799bccb8c0b9096566 (diff) |
Add fragment links to sub-headers in docs (fixes #61)
Allows users to copy links to sub-headers within docs.
Diffstat (limited to 'layouts/partials/scripts.html')
-rw-r--r-- | layouts/partials/scripts.html | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index b6f9696d3..52c7c327f 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -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(' <a href="#'+fragment+'" class="header-link"><i class="fas fa-link"></i></a>'); + }); +</script> |