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 · 1 comment · Fixed by #6643
Closed

Preserve HTML Text also for image render hooks #6639

onedrawingperday opened this issue Dec 19, 2019 · 1 comment · Fixed by #6643
Labels
Milestone

Comments

@onedrawingperday
Copy link
Contributor

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 as completed in #6643 Dec 19, 2019
bep added a commit that referenced this issue Dec 19, 2019
@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 Feb 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants