From f225fbaedec3d93fa0c5b725bb416c7819d23d77 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 9 May 2025 09:39:17 +0800 Subject: feat: render markdown image with necessary context By context I mean necessary attributes, parents and brothers. Now I can use bare ![]() instead of img shortcode to insert images with fancybox, lazyloading and caption. Recommended format: ```markdown ![alt text](image_source "caption text") ``` Former-commit-id: d6219f997cab144905ce07b0a3b61b36b24495fa --- layouts/_default/_markup/render-image.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 layouts/_default/_markup/render-image.html (limited to 'layouts/_default/_markup/render-image.html') diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 00000000..697c33c2 --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,16 @@ +{{- $src := .Destination -}} +{{- $alt := .Text | default "" -}} +{{- $caption := .Title | default "" -}} +
+ + {{ $alt }} + + {{- if $caption }} +
+

{{ $caption | markdownify }}

+
+ {{- end }} +
-- cgit v1.2.3