Files
FastGPT/docSite/layouts/docs/_markup/render-image.html
Carson Yang 13eda40443 docs: optimize css style (#700)
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
2024-01-06 18:42:27 +08:00

32 lines
1.2 KiB
HTML

{{ $dest := .Destination }}
{{ $text := .PlainText }}
{{ $url := urls.Parse $dest }}
{{ if .Title }}
<figure>
{{ if eq $url.Scheme "" }}
{{ with $image := resources.Get $dest }}
{{ if eq $image.MediaType.SubType "svg" }}
{{ $image.Content | safeHTML }}
{{ else }}
<img src="{{ $image.RelPermalink | safeURL }}" alt="{{ $text }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy" class="medium-zoom-image">
{{ end }}
{{ end }}
{{ else }}
<img src="{{ $dest | safeURL }}" alt="{{ $text }}" loading="lazy" class="medium-zoom-image">
{{ end }}
<figcaption>{{ .Title | markdownify }}</figcaption>
</figure>
{{ else }}
{{ if eq $url.Scheme "" }}
{{ with $image := resources.Get $dest }}
{{ if eq $image.MediaType.SubType "svg" }}
{{ $image.Content | safeHTML }}
{{ else }}
<img src="{{ $image.RelPermalink | safeURL }}" alt="{{ $text }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy" class="medium-zoom-image">
{{ end }}
{{ end }}
{{ else }}
<img src="{{ $dest | safeURL }}" alt="{{ $text }}" loading="lazy" class="medium-zoom-image">
{{ end }}
{{ end }}