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

Softbreaks in the alt text of images are eaten #11681

Closed
yihui opened this issue Nov 8, 2023 · 2 comments · Fixed by #11682
Closed

Softbreaks in the alt text of images are eaten #11681

yihui opened this issue Nov 8, 2023 · 2 comments · Fixed by #11682
Assignees

Comments

@yihui
Copy link
Contributor

yihui commented Nov 8, 2023

I have asked the question on the forum and was suggested to file an issue here.


Originally this was an issue in goldmark but it has been fixed recently (in 1.6.0), which has been picked up by Hugo 0.120.3. However, when I render an image like this:

![alt
tex](logo.png)

it still gives me

<img src="logo.png" alt="alttext">

That is, the softbreak was still eaten. I'm hoping to get

<img src="logo.png" alt="alt
text">

From @jmooring:

I’ve verified that (a) v0.120.3 is using yuin/goldmark v1.6.0, and (b) yuin/goldmark v1.6.0 resolves the reported problem. So, this looks like a bug in Hugo’s parser.


What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.120.3-a4892a07b41b7b3f1f143140ee4ec0a9a5cf3970+extended darwin/arm64 BuildDate=2023-11-01T17:57:00Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes.

@jmooring
Copy link
Member

jmooring commented Nov 8, 2023

@yihui Until this is resolved, you can use this image render hook...

layouts/_default/_markup/render-image.html

<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{- with .Title }} title="{{ . }}"{{ end }}>
{{- /**/ -}}

jmooring added a commit to jmooring/hugo that referenced this issue Nov 8, 2023
yihui added a commit to yihui/misc.js that referenced this issue Nov 8, 2023
@jmooring jmooring self-assigned this Nov 9, 2023
Copy link

github-actions bot commented Dec 8, 2023

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 Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants