Skip to content
Permalink
Browse files

[docs] add anchor links for deep linking to section titles (#894)

* [docs] add anchor links for deep linking to section titles

Signed-off-by: flynnduism <flynnduism@gmail.com>

* [docs] re build

Signed-off-by: flynnduism <flynnduism@gmail.com>
  • Loading branch information
flynnduism authored and technosophos committed May 9, 2019
1 parent bb024e8 commit 82cd846e6c1cdcee1228367cac3e8e4f0f601897
@@ -6,7 +6,7 @@ relativeURLs = "true"

[params]
title = "Brigade"
description = "Brigade - Event-driven scripting for Kubernetes."
description = "Brigade: Event-driven scripting for Kubernetes."

# main docs 'index' menu on left
[[menu.index]]

Large diffs are not rendered by default.

@@ -1 +1 @@
{"Target":"scss/theme.min.ad84aa499e54c12c07faca8600e8bf86bb7b1c642a7ba457ed04dd1a1a1ad28b.css","MediaType":"text/css","Data":{"Integrity":"sha256-rYSqSZ5UwSwH+sqGAOi/hrt7HGQqe6RX7QTdGhoa0os="}}
{"Target":"scss/theme.min.83308868dbeaaab9b99176cdfde01c900c3b77e680efaf2ba717f4853ae19a4c.css","MediaType":"text/css","Data":{"Integrity":"sha256-gzCIaNvqqrm5kXbN/eAckAw7d+aA768rpxf0hTrhmkw="}}
@@ -148,6 +148,35 @@ main article.content-wrap {
margin-bottom: 1.25rem;
}

h2, h3, h4, h5, h6 {
position: relative;

// anchor links for section titles
.header-link {
position: absolute;
left: -1em;
opacity: 0;
font-size: 1rem;
padding-top: 0.333em;
text-decoration: none;
transition: all 0.3s ease-in-out;

&:hover {
border-bottom: none;
background-color: transparent;
}
}

&:hover {
color: $blued;

.header-link {
opacity: 1;
left: -1.75em;
}
}
}

// page title area
h1 + h1 {
font-weight: normal;
@@ -1,6 +1,8 @@
{{- define "main" -}}
<article id="{{ .Slug }}">
<h1>{{ .Title }}</h1>
{{- .Content -}}
{{- partial "edit-meta.html" . -}}
</article>
{{- partial "pagination.html" . -}}
{{- end -}}
@@ -10,6 +10,7 @@
<i class="fas fa-arrow-circle-up"></i>
</span></a>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script type="text/javascript">
// make the sidebar sticky on scroll
var affixMenu = document.querySelector(".sidebar");
@@ -21,4 +22,17 @@
affixMenu.classList.remove("fixed");
};
}
// add permalinks to titles
$(function() {
return $("h2, h3, h4, h5, h6").each(function(i, el) {
var $el, icon, id;
$el = $(el);
id = $el.attr('id');
icon = '&#9875;';
if (id) {
return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
}
});
});
</script>

0 comments on commit 82cd846

Please sign in to comment.
You can’t perform that action at this time.