From 375281fd60b39685052c9f8cd6357392724113e1 Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 1 Jun 2022 16:21:06 +0800 Subject: [PATCH] fix shortcodes rendering markdown img MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit replace markdownify with .Page.RenderString, the latter trigger render hook properly see: https://gohugo.io/functions/markdownify/#readout > Note: if you need Render Hooks, which markdownify doesn’t currently support, use .RenderString instead. --- layouts/shortcodes/collapse.html | 2 +- layouts/shortcodes/figure-img.html | 2 +- layouts/shortcodes/image-size-control.html | 2 +- layouts/shortcodes/standout.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/shortcodes/collapse.html b/layouts/shortcodes/collapse.html index 1c5e96f..71d13d6 100644 --- a/layouts/shortcodes/collapse.html +++ b/layouts/shortcodes/collapse.html @@ -1,4 +1,4 @@

{{ .Get 0 | markdownify }} - {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }}

diff --git a/layouts/shortcodes/figure-img.html b/layouts/shortcodes/figure-img.html index 49057c8..e2aaeaf 100644 --- a/layouts/shortcodes/figure-img.html +++ b/layouts/shortcodes/figure-img.html @@ -1,5 +1,5 @@
- {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }}

{{ .Get 0 | markdownify }}

diff --git a/layouts/shortcodes/image-size-control.html b/layouts/shortcodes/image-size-control.html index 170322f..1bf374d 100644 --- a/layouts/shortcodes/image-size-control.html +++ b/layouts/shortcodes/image-size-control.html @@ -2,5 +2,5 @@ {{- with (.Get "width") }}max-width: {{ . }};{{ end -}} {{- with (.Get "height") }}max-height: {{ . }};{{ end -}} "> - {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }} diff --git a/layouts/shortcodes/standout.html b/layouts/shortcodes/standout.html index 0c982ba..0e8237a 100644 --- a/layouts/shortcodes/standout.html +++ b/layouts/shortcodes/standout.html @@ -1,3 +1,3 @@

- {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }}