Handle non-ascii chars in toc id

This commit is contained in:
Zachary Betz 2019-02-26 10:16:01 -06:00
parent 5645700243
commit 35ccaa287e

View File

@ -5,7 +5,11 @@
<ol>
{{ range $headings }}
<li>
<a href="#{{ . | htmlUnescape | plainify | urlize }}">
{{ $id := findRE "id=\".*\"" . }}
{{ $id = index $id 0 }}
{{ $id = strings.TrimPrefix "id=\"" $id }}
{{ $id = strings.TrimSuffix "\"" $id }}
<a href="#{{ $id }}">
{{ . | htmlUnescape | plainify }}
</a>
</li>