Skip to content

Conversation

@mre
Copy link
Member

@mre mre commented Sep 5, 2025

Fixes fragment checking for JavaDoc-generated HTML which uses instead of id attributes for anchors.

This resolves a regression where lychee v0.20.1 was failing to find fragments that worked in v0.18.1, particularly for JavaDoc URLs like:

The fix maintains backward compatibility by checking both 'id' and 'name' attributes when extracting fragments from HTML documents.

Resolves #1838

Fixes fragment checking for JavaDoc-generated HTML which uses
<a name="anchor"> instead of id attributes for anchors.

This resolves a regression where lychee v0.20.1 was failing to find
fragments that worked in v0.18.1, particularly for JavaDoc URLs like:
- https://example.com/javadoc/Class.html#method--
- https://example.com/javadoc/Class.html#skip.navbar.top

The fix maintains backward compatibility by checking both 'id' and
'name' attributes when extracting fragments from HTML documents.

Resolves #1838
Copy link
Member

@thomas-zahner thomas-zahner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix 👍

}

// Also check for 'name' attributes for backward compatibility with older HTML
// standards and JavaDoc-generated HTML which uses <a name="anchor"> instead of id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could add: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#name or https://stackoverflow.com/a/484781

So apparently in HTML 4.01it both could be used. Theoretically, it's no longer valid HTML 5, but it's still used by some tools/sites because of historical reasons.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, neat. I've extended the documentation accordingly.

@mre mre merged commit b40fc2c into master Sep 6, 2025
6 checks passed
@mre mre deleted the fix/fragment-name-attribute-support branch September 6, 2025 12:37
@mre mre mentioned this pull request Sep 6, 2025
This was referenced Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Latest version of Lychee cannot find fragments anymore

3 participants