Update image render hooks examples to conform with Commonmark

This commit is contained in:
Joe Mooring 2025-01-07 18:10:30 -08:00 committed by GitHub
parent 5391dddeac
commit 4429eeeea8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -91,7 +91,7 @@ In its default configuration, Hugo renders Markdown images according to the [Com
{{< code file=layouts/_default/_markup/render-image.html copy=true >}} {{< code file=layouts/_default/_markup/render-image.html copy=true >}}
<img src="{{ .Destination | safeURL }}" <img src="{{ .Destination | safeURL }}"
{{- with .Text }} alt="{{ . }}"{{ end -}} {{- with .PlainText }} alt="{{ . }}"{{ end -}}
{{- with .Title }} title="{{ . }}"{{ end -}} {{- with .Title }} title="{{ . }}"{{ end -}}
> >
{{- /* chomp trailing newline */ -}} {{- /* chomp trailing newline */ -}}
@ -103,13 +103,13 @@ To render standalone images within `figure` elements:
{{- if .IsBlock -}} {{- if .IsBlock -}}
<figure> <figure>
<img src="{{ .Destination | safeURL }}" <img src="{{ .Destination | safeURL }}"
{{- with .Text }} alt="{{ . }}"{{ end -}} {{- with .PlainText }} alt="{{ . }}"{{ end -}}
> >
{{- with .Title }}<figcaption>{{ . }}</figcaption>{{ end -}} {{- with .Title }}<figcaption>{{ . }}</figcaption>{{ end -}}
</figure> </figure>
{{- else -}} {{- else -}}
<img src="{{ .Destination | safeURL }}" <img src="{{ .Destination | safeURL }}"
{{- with .Text }} alt="{{ . }}"{{ end -}} {{- with .PlainText }} alt="{{ . }}"{{ end -}}
{{- with .Title }} title="{{ . }}"{{ end -}} {{- with .Title }} title="{{ . }}"{{ end -}}
> >
{{- end -}} {{- end -}}