{{- /* Content images. The Markdown title ("![alt](src "© Credit")") is the photo credit; it is shown as a caption instead of a tooltip, so that it is available on touch devices and to screen readers. An image on its own line becomes a figure; images sharing a paragraph get an inline credit. */ -}} {{- $src := .Destination -}} {{- $width := 0 -}} {{- $height := 0 -}} {{- with or (.PageInner.Resources.Get (strings.TrimPrefix "./" .Destination)) (resources.Get .Destination) -}} {{- $src = .RelPermalink -}} {{- if and (eq .ResourceType "image") (ne .MediaType.SubType "svg") -}} {{- $width = .Width -}} {{- $height = .Height -}} {{- end -}} {{- end -}} {{- /* A title that only repeats the alt text is not a credit. */ -}} {{- $credit := cond (eq .Title .PlainText) "" .Title -}} {{- $img := printf `%s` (htmlEscape $src) (htmlEscape .PlainText) (cond (gt $width 0) (printf ` width="%d" height="%d"` $width $height) "") -}} {{- if .IsBlock -}}
{{ $img | safeHTML }} {{- with $credit }}
{{ . }}
{{- end }}
{{- else if $credit -}} {{ $img | safeHTML }}{{ $credit }} {{- else -}} {{ $img | safeHTML }} {{- end -}}