Add header links

This commit is contained in:
Will Faught
2022-12-11 04:26:58 -08:00
parent da47e03ea9
commit a90d3c7061
3 changed files with 11 additions and 1 deletions

View File

@@ -14,5 +14,5 @@
<p class="text-center text-muted"><time datetime="{{ .PublishDate.Format `2006-01-02` }}">{{ .PublishDate.Format "January 2, 2006" }}</time></p>
{{ end }}
{{ if .Content }}
{{ .Content }}
{{ .Content | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` `${1}<a class="headerlink" href="#${2}"><i class="bi bi-link-45deg small"></i></a>${3}` | safeHTML }}
{{ end }}

View File

@@ -12,4 +12,13 @@
blockquote p:last-of-type {
margin-bottom: 0;
}
.headerlink {
display: none;
margin-left: 0.25rem;
}
h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink {
display: inline;
}
</style>