Add anchors to headings

This commit is contained in:
Alex Shpak
2020-05-30 20:50:08 +02:00
parent 1608ade3f4
commit aa7c486e76
5 changed files with 46 additions and 16 deletions
@@ -0,0 +1,4 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text | safeHTML }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
+1 -1
View File
@@ -6,7 +6,7 @@
{{- define "portable-link" -}}
{{- $destination := .Destination }}
{{- $isRemote := or (in .Destination "://") (strings.HasPrefix .Destination "//") }}
{{- $isRemote := or (in .Destination ":") (strings.HasPrefix .Destination "//") }}
{{- if not $isRemote }}
{{- $url := urls.Parse .Destination }}
{{- $path := strings.TrimSuffix "/_index.md" $url.Path }}