feat: add support for custom heading css class (#381)

This commit is contained in:
Robert Kaussow 2023-04-21 23:05:46 +02:00 committed by GitHub
parent 0b2444e0cc
commit eb86a76010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,10 @@
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
{{- if $showAnchor -}} {{- if $showAnchor -}}
<div class="gblog-post__anchorwrap"> <div class="gblog-post__anchorwrap">
<h{{ .Level }} id="{{ .Anchor | safeURL }}"> <h{{ .Level }} id="{{ .Anchor | safeURL }}" {{- with .Attributes.class }}
class="{{ . }}"
{{- end }}
>
{{ .Text | safeHTML }} {{ .Text | safeHTML }}
<a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gblog-post__anchor clip flex align-center" aria-label="Anchor {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}"> <a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gblog-post__anchor clip flex align-center" aria-label="Anchor {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}">
<svg class="gblog-icon gblog_link"><use xlink:href="#gblog_link"></use></svg> <svg class="gblog-icon gblog_link"><use xlink:href="#gblog_link"></use></svg>
@ -13,7 +16,10 @@
</div> </div>
{{- else -}} {{- else -}}
<div class="gblog-post__anchorwrap"> <div class="gblog-post__anchorwrap">
<h{{ .Level }} id="{{ .Anchor | safeURL }}"> <h{{ .Level }} id="{{ .Anchor | safeURL }}" {{- with .Attributes.class }}
class="{{ . }}"
{{- end }}
>
{{ .Text | safeHTML }} {{ .Text | safeHTML }}
</h{{ .Level }}> </h{{ .Level }}>
</div> </div>