Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdownify function does not call render-link hook #6650

Closed
jakejarvis opened this issue Dec 20, 2019 · 5 comments
Closed

Markdownify function does not call render-link hook #6650

jakejarvis opened this issue Dec 20, 2019 · 5 comments

Comments

@jakejarvis
Copy link
Contributor

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!

@bep
Copy link
Member

bep commented Dec 20, 2019

  • 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.

@jakejarvis
Copy link
Contributor Author

Will give .RenderString a shot, thanks!

@jakejarvis jakejarvis changed the title Markdown links passed to shortcode via .Inner not affected by render-link hook Markdownify function does not call render-link hook Dec 20, 2019
@bep bep added this to the v0.63 milestone Dec 20, 2019
@jakejarvis
Copy link
Contributor Author

{{ with .Inner }} {{ $.Page.RenderString . }} {{ end }} works great. 👍

@bep bep modified the milestones: v0.63, v0.64 Jan 22, 2020
@bep bep modified the milestones: v0.64, v0.65 Jan 30, 2020
@bep bep modified the milestones: v0.65, v0.66 Feb 18, 2020
@bep bep modified the milestones: v0.66, v0.67 Mar 2, 2020
@bep bep modified the milestones: v0.67, v0.68 Mar 9, 2020
@bep bep modified the milestones: v0.68, v0.69 Mar 20, 2020
@bep bep modified the milestones: v0.69, v0.70 Apr 8, 2020
@bep bep modified the milestones: v0.70, v0.71 Apr 28, 2020
@bep bep modified the milestones: v0.71, v0.72 May 18, 2020
@bep bep modified the milestones: v0.72, v0.73 May 31, 2020
@bep bep modified the milestones: v0.73, v0.74 Jun 23, 2020
@bep bep removed this from the v0.74 milestone Jul 13, 2020
@bep bep added this to the v0.75 milestone Jul 13, 2020
@bep bep modified the milestones: v0.75, v0.76 Sep 14, 2020
@bep bep modified the milestones: v0.76, v0.77 Oct 6, 2020
benesch added a commit to benesch/materialize that referenced this issue Oct 6, 2020
The markdownify filter does not properly support render hooks, but the
slightly-clunkier .RenderString method does. See gohugoio/hugo#6650 for
context.

The observable behavior of this is that markdownify does not properly
add the base URL prefix (i.e. /docs) to links within its input, while
RenderString does.
benesch added a commit to benesch/materialize that referenced this issue Oct 6, 2020
The markdownify filter does not properly support render hooks, but the
slightly-clunkier .RenderString method does. See gohugoio/hugo#6650 for
context.

The observable behavior of this is that markdownify does not properly
add the base URL prefix (i.e. /docs) to links within its input, while
RenderString does.
@bep bep modified the milestones: v0.77, v0.78 Oct 30, 2020
@jmooring
Copy link
Member

It seems like this issue was resolved with creation of the .RenderString page method. For example, within a shortcode:

{{ .Inner | .Page.RenderString }}

Can we close this issue?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants