Fix anchor validation for HTML name attribute (#89)#94
Merged
Conversation
This commit fixes issue #89 where anchor validation fails on links like `../file.md#anchors` when the anchor is defined using HTML `<a name="...">` tags instead of `<a id="...">` tags. Changes: - Updated HTML_LINK_PATTERN to match both 'id' and 'name' attributes - Changed from greedy to non-greedy matching to handle multiple anchors on the same line - Modified contains_anchor() to use re.findall() instead of re.match() to find all anchors on a line - Added comprehensive test cases for HTML anchors with both id and name attributes, including anchors in table cells and with dots in names The fix is backward compatible and handles: - Legacy <a name="..."> tags (commonly used in tables) - Modern <a id="..."> tags - Multiple anchors on a single line (e.g., in table rows) - Anchors with special characters like dots (e.g., REGISTER.FIELD1) Fixes #89 Co-Authored-By: Claude <claude@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit fixes issue #89 where anchor validation fails on links like
../file.md#anchorswhen the anchor is defined using HTML<a name="...">tags instead of<a id="...">tags.Changes: