summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIan Lewis <ianmlewis@gmail.com>2019-06-13 22:14:41 -0400
committerIan Lewis <ianlewis@google.com>2019-06-26 13:15:57 +0800
commit8e6c43e5c57ffbe6a4c0c11f1e61e2eaa76db52c (patch)
treeb05e896b99da54886dc43629a07be25189101c3b
parent8d8380564f8284899183a0799bccb8c0b9096566 (diff)
Add fragment links to sub-headers in docs (fixes #61)
Allows users to copy links to sub-headers within docs.
-rw-r--r--assets/scss/_styles_project.scss7
-rw-r--r--layouts/partials/scripts.html7
2 files changed, 14 insertions, 0 deletions
diff --git a/assets/scss/_styles_project.scss b/assets/scss/_styles_project.scss
index 306686006..556a16ab7 100644
--- a/assets/scss/_styles_project.scss
+++ b/assets/scss/_styles_project.scss
@@ -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%;
+ }
+}
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('&nbsp;<a href="#'+fragment+'" class="header-link"><i class="fas fa-link"></i></a>');
+ });
+</script>