Environment
Problem
The render hook used by Docsy to add IDs to headings and to auto-link them ignores any custom classes that can be added using Markdown Attributes, breaking a core Hugo feature this way. In contrast, it adds custom IDs just fine.
The render hook was seemingly introduced with this PR.
The bug can be fixed as follows:
<h{{ .Level }} id="{{- .Anchor | safeURL -}}">
{{- .Text | safeHTML -}}
{{ template "_default/_markup/_td-heading-self-link.html" . -}}
</h{{ .Level }}>
{{- define "_default/_markup/_td-heading-self-link.html" -}}
<a class="td-heading-self-link" href="#{{ .Anchor | safeURL }}" aria-label="Heading self-link"></a>
{{- end -}}
<h{{ .Level }} id="{{- .Anchor | safeURL -}}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
{{- .Text | safeHTML -}}
{{ template "_default/_markup/_td-heading-self-link.html" . -}}
</h{{ .Level }}>
{{- define "_default/_markup/_td-heading-self-link.html" -}}
<a class="td-heading-self-link" href="#{{ .Anchor | safeURL }}" aria-label="Heading self-link"></a>
{{- end -}}
Environment
hugo version): 0.139.3+extended+withdeployProblem
The render hook used by Docsy to add IDs to headings and to auto-link them ignores any custom classes that can be added using Markdown Attributes, breaking a core Hugo feature this way. In contrast, it adds custom IDs just fine.
The render hook was seemingly introduced with this PR.
The bug can be fixed as follows: