fix: enhance image caption handling by using title attribute if available (#1265)
* fix: enhance image caption handling by using title attribute if available * feat: support markdown syntax inside image caption
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{{- $image := partial "helper/image" (dict "Resources" .Page.Resources "Image" .Destination) -}}
|
||||
{{- $alt := .PlainText | safeHTML -}}
|
||||
{{- $title := .Title | markdownify -}}
|
||||
|
||||
{{/* SVG and external images won't work with gallery layout, because their width and height attributes are unknown */}}
|
||||
{{- $galleryImage := and $image.Height $image.Width -}}
|
||||
@@ -11,6 +12,10 @@
|
||||
{{ with $alt }}
|
||||
alt="{{ . }}"
|
||||
{{ end }}
|
||||
{{ with $title }}
|
||||
title="{{ . }}"
|
||||
data-title-escaped="{{ . | htmlEscape }}"
|
||||
{{ end }}
|
||||
{{ if $galleryImage }}
|
||||
class="gallery-image"
|
||||
data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
|
||||
|
||||
Reference in New Issue
Block a user