feat: anchor link checks support HTML tags like `<a name="foo"></a>`
Extracts all html tags with the attribute id and all a tags with the attribute name and allows them as valid section links.
Ignore:
- code blocks (
```) - single code (
`) - html comments
Fits the lint rule MD51
Alternatively, any HTML tag with an
idattribute or anatag with anameattribute can be used to define a fragment
fixes:
- #202
- #195
related to:
- #328
@dklimpel
[Item 1](#item-one)
[Item 2](#item-two)
<a id="item-one">Item 1 target</a>
<a id='item-two'>Item 2 target</a>
resulted in
$ npx markdown-link-check anchor-in-html-test.md
FILE: anchor-in-html-test.md
[✓] #item-one
[✖] #item-two
2 links checked.
ERROR: 1 dead links found!
[✖] #item-two → Status: 404
using
[email protected] (git+ssh://[email protected]/dklimpel/markdown-link-check.git#cb1cb610ac08ba78d9f8735402929722d7253088)
Would you expect single quotes to work as well as the double quotes?
Would you expect single quotes to work as well as the double quotes?
Single quotes were not yet in the scope.
@dklimpel
Single quotes were not yet in the scope.
Do you plan to add them in this PR? It may be confusing to have only double quotes working if this PR is merged as is.
I have added a new commit for supporting single quotes.
@dklimpel
Great work! I confirm it works!
It would be really great to have this. Having a similar issue when adding HTML links to markdown table cells like <a id="android-os-api-level" href="#android-os-api-level">android.os.api_level</a> and the check is failing now.
@tcort I have resolved the conflicts.