diff options
| author | Reorx <novoreorx@gmail.com> | 2022-06-01 16:21:06 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-06-01 16:21:06 +0800 |
| commit | 375281fd60b39685052c9f8cd6357392724113e1 (patch) | |
| tree | 2aa2a6385ce496858ad5528f39e60518c8e56d09 | |
| parent | 82a79a8354a2b9a84dc14e9f50963e313e488cd8 (diff) | |
fix shortcodes rendering markdown img
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.
| -rw-r--r-- | layouts/shortcodes/collapse.html | 2 | ||||
| -rw-r--r-- | layouts/shortcodes/figure-img.html | 2 | ||||
| -rw-r--r-- | layouts/shortcodes/image-size-control.html | 2 | ||||
| -rw-r--r-- | 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 @@ <p><details {{ if (eq (.Get "openByDefault") true) }} open=true {{ end }}> <summary markdown="span">{{ .Get 0 | markdownify }}</summary> - {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }} </details></p> 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 @@ <figure class="center align-center"> - {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }} <figcaption><p>{{ .Get 0 | markdownify }}</p></figcaption> </figure> 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 }} </div> 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 @@ <p class="standout"> - {{ .Inner | markdownify }} + {{ .Page.RenderString .Inner }} </p> |
