Hugo: Markdownify function does not call render-link hook

Created on 20 Dec 2019  路  3Comments  路  Source: gohugoio/hugo

Not an urgent bug, but I have an image shortcode capable of passing a markdown caption that's retrieved by .Inner. Everything renders correctly as HTML (same as v0.61) but my render-link.html hook doesn't seem to be called by it.

This might be a bigger problem with markdownify not calling the new hooks?

Hugo Static Site Generator v0.62.0-DEV-8A58EBB3/extended darwin/amd64 BuildDate: 2019-12-20T11:59:39-0500

shortcodes/image.html:

{{ with .Inner }}
<figcaption>{{ . | markdownify | safeHTML }}</figcaption>
{{ end }}

_default/_markup/render-link.html:

testing....this doesn't appear <a href="{{ .Destination | safeURL }}" target="_blank">{{ .Text | safeHTML }}</a> 

test.md:

{{< image >}}A caption [linking to Google](https://google.com).{{< /image >}}

renders...

A caption <a href="https://google.com">linking to Google</a>.

instead of...

A caption testing....this doesn't appear <a href="https://google.com" target="_blank">linking to Google</a>.

Hope this makes sense!

Enhancement

Most helpful comment

{{ with .Inner }} {{ $.Page.RenderString . }} {{ end }} works great. 馃憤

All 3 comments

  • markdownify doesn't (currently) support these hooks. It was a little bit hard/time consuming so I dropped it (for now, anyway).
  • That said, .RenderString which is markdownofiy's new more powerful cousin, does support it.

Will give .RenderString a shot, thanks!

{{ with .Inner }} {{ $.Page.RenderString . }} {{ end }} works great. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

digitalcraftsman picture digitalcraftsman  路  3Comments

bep picture bep  路  3Comments

nikolas picture nikolas  路  3Comments

moorereason picture moorereason  路  3Comments

arikroc picture arikroc  路  3Comments