[CommonMark specification]: https://spec.commonmark.org/current/
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
-<h{{ .Level }} id="{{ .Anchor }}">
+<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
{{- .Text -}}
</h{{ .Level }}>
{{< /code >}}
To add an anchor link to the right of each heading:
{{< code file=layouts/_default/_markup/render-heading.html copy=true >}}
-<h{{ .Level }} id="{{ .Anchor }}">
+<h{{ .Level }} id="{{ .Anchor }}" {{- with .Attributes.class }} class="{{ . }}" {{- end }}>
{{ .Text }}
<a href="#{{ .Anchor }}">#</a>
</h{{ .Level }}>
{{< code file=layouts/_default/_markup/render-image.html copy=true >}}
<img src="{{ .Destination | safeURL }}"
- {{- with .Text }} alt="{{ . }}"{{ end -}}
+ {{- with .PlainText }} alt="{{ . }}"{{ end -}}
{{- with .Title }} title="{{ . }}"{{ end -}}
>
{{- /* chomp trailing newline */ -}}
{{- if .IsBlock -}}
<figure>
<img src="{{ .Destination | safeURL }}"
- {{- with .Text }} alt="{{ . }}"{{ end -}}
+ {{- with .PlainText }} alt="{{ . }}"{{ end -}}
>
{{- with .Title }}<figcaption>{{ . }}</figcaption>{{ end -}}
</figure>
{{- else -}}
<img src="{{ .Destination | safeURL }}"
- {{- with .Text }} alt="{{ . }}"{{ end -}}
+ {{- with .PlainText }} alt="{{ . }}"{{ end -}}
{{- with .Title }} title="{{ . }}"{{ end -}}
>
{{- end -}}