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

Hyperlinks in headers “leak” into header anchors #13405

Closed
Expurple opened this issue Feb 16, 2025 · 0 comments · Fixed by #13407
Closed

Hyperlinks in headers “leak” into header anchors #13405

Expurple opened this issue Feb 16, 2025 · 0 comments · Fixed by #13407

Comments

@Expurple
Copy link

Expurple commented Feb 16, 2025

Previously reported on the Kayal theme repo, and then on the Hugo forum.

Related to #13401, #13404.


Describe the bug

Header anchors contain the destinations of hyperlinks in the header. This makes them long and unreadable.

This forces me to avoid hyperlinks in headers, which by themselves are functional.

Reproducible example

## Example [hyperlink](https://example.com/) in a header

generates

Image

where the anchor at the right is #example-hyperlinkhttpsexamplecom-in-a-header

Expected behavior

I expected a short and pretty anchor, containing only the visible text:

#example-hyperlink-in-a-header

The same as the one generated from a non-hyperlinked version of the same header:

## Example hyperlink in a header

Desktop (please complete the following information):

  • OS: Kubuntu 24.10 (x64)
  • Browser: Firefox 134.0 (64-bit)
  • Hugo Version: 0.129.0 from the distro
  • Kayal Version: 0.3.4

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

$ hugo version
hugo v0.129.0+extended linux/amd64 BuildDate=2024-08-13T17:51:38Z VendorInfo=ubuntu:0.129.0-2

Does this issue reproduce with the latest release?

Yes. Before reporting, I downloaded Hugo 0.143.1 from Github Releases and tried it too.

bep added a commit to bep/hugo that referenced this issue Feb 16, 2025
@bep bep mentioned this issue Feb 16, 2025
bep added a commit to bep/hugo that referenced this issue Feb 16, 2025
bep added a commit to bep/hugo that referenced this issue Feb 16, 2025
bep added a commit to bep/hugo that referenced this issue Feb 17, 2025
…stinations (note)

This makes the header ids match the newly added dt ids.

Also make sure newlines are preserved in hooks' `.PlainText`.

Fixes gohugoio#13405
Fixes gohugoio#13410
bep added a commit that referenced this issue Feb 17, 2025
…stinations (note)

This makes the header ids match the newly added dt ids.

Also make sure newlines are preserved in hooks' `.PlainText`.

Fixes #13405
Fixes #13410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant