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

Preserve HTML Text also for image render hooks #6639

Closed
onedrawingperday opened this issue Dec 19, 2019 · 0 comments · Fixed by #6643
Closed

Preserve HTML Text also for image render hooks #6639

onedrawingperday opened this issue Dec 19, 2019 · 0 comments · Fixed by #6643
Milestone

Comments

@onedrawingperday
Copy link
Contributor

@onedrawingperday onedrawingperday commented Dec 19, 2019

This issue is related to #6622

Since 00954c5 was merged:

The following under /layouts/_default/_markup/render-link.html:

<a href="{{ .Destination | safeURL }}"{{ with .Title}}title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>

And [Hello<br> Goodbye](/somewhere/) in a content file

Will be rendered as: <a href="/somewhere/">Hello<br> Goodbye</a>


But the above is currently not possible for image render hooks:

For example:

With the following template code under /layouts/_default/_markup/render-image.html:

<figure><img class="someClass" src="{{ .Destination }}" alt="{{ .PlainText }}"/><figcaption>{{ .Text | safeHTML }}</figcaption></figure>

And the following markdown in a content file: ![Hello<br> Goodbye](image.jpg)

Will be rendered as:

<figure><img class="someClass" src="image.jpg" alt="Hello Goodbye"/><figcaption>Hello Goodbye</figcaption></figure>

i.e. The HTML <br> tag is ignored.

Please consider adding this functionality.

@onedrawingperday onedrawingperday changed the title Preserve HTML also Text for image render hooks Preserve HTML Text also for image render hooks Dec 19, 2019
bep added a commit to bep/hugo that referenced this issue Dec 19, 2019
@bep bep added this to the v0.62 milestone Dec 19, 2019
@bep bep closed this in #6643 Dec 19, 2019
bep added a commit that referenced this issue Dec 19, 2019
Fixes #6639
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.