feat: add article.headingAnchor parameter

This commit is contained in:
Jimmy Cai 2024-05-02 23:18:45 +02:00
parent 130e2f6607
commit bdf2a710d3
2 changed files with 4 additions and 1 deletions

View File

@ -28,6 +28,7 @@ params:
src: img/avatar.png src: img/avatar.png
article: article:
headingAnchor: true
math: false math: false
toc: true toc: true
readingTime: true readingTime: true

View File

@ -1,4 +1,6 @@
<h{{ .Level }} id="{{ .Anchor }}"> <h{{ .Level }} id="{{ .Anchor }}">
<a href="#{{ .Anchor }}" class="header-anchor">#</a> {{- if site.Params.Article.HeadingAnchor -}}
<a href="#{{ .Anchor }}" class="header-anchor"></a>
{{- end -}}
{{ .Text | safeHTML }} {{ .Text | safeHTML }}
</h{{ .Level }}> </h{{ .Level }}>