Skip to content

Commit f129449

Browse files
authored
Merge pull request #45 from rmoff/add-heading-links
Add hash symbol as indicator that headings are anchor linked
2 parents cbd2e9b + ad6b3f1 commit f129449

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

themes/story/layouts/_default/single.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{{ define "main" }}
44
<article class="center bg-white br-3 pv1 ph4 lh-copy f5 nested-links mw8">
5-
{{ .Content }}
5+
{{ .Content | replaceRE "(<h[2-9] id=\"([^\"]+)\".+)(</h[2-9]+>)" "${1}&nbsp;<a class=\"headline-hash\" href=\"#${2}\">#</a> ${3}" | safeHTML }}
66
</article>
77
{{ end }}
88

themes/story/static/css/story.css

+1
Original file line numberDiff line numberDiff line change
@@ -417,3 +417,4 @@ img[src~="3dbook"] {
417417
.hljs-link {
418418
text-decoration: underline;
419419
}
420+
a.headline-hash {opacity: 40%; text-decoration: none;}

0 commit comments

Comments
 (0)