markdown-link-check icon indicating copy to clipboard operation
markdown-link-check copied to clipboard

anchor link checking is broken

Open OmarTawfik opened this issue 3 years ago • 5 comments

Thanks for the awesome linter. Long time user, first time contributor. I have a bunch of files that define HTML code blocks, with id attributes:

<code id="foo"> .... </code>
<code id="bar"> .... </code>

Then I have some links that reference them:

<a href="#foo"> ... </a>
<a href="../other-file/#bar"> ... </a>

After upgrading to the latest version 3.10.3, it broke CI because of new errors everywhere. I traced it down to the following issues:

  1. The linter doesn't collect links from id attributes. So any links pointing to it (like href="#foo") produce errors.
  2. The linter doesn't lint href attributes that have a file path AND a header.
    1. href=".#id" for the same markdown file.
    2. href="../relative/path#id" for a markdown file at ../relative/path.md or ../relative/path/index.md.

Any feedback/pointers are greatly appreciated. I imagine it is not too hard to fix, given that the linter has partial support for it already.

Although my plate is currently full, I welcome any code pointers/green light on how to fix it, and I can take a stab at it at some point in the future.

OmarTawfik avatar Dec 08 '22 22:12 OmarTawfik

cc @tcort any thoughts about how involving the fix is? I imagine it is a simple change, but probably involves a few different packages.

OmarTawfik avatar Dec 21 '22 22:12 OmarTawfik

  • This is also discussed in issue #195

MikeMcC399 avatar Feb 22 '23 17:02 MikeMcC399

I can't see any replies from @tcort for the last three months 😵‍💫 so I'm wondering if the repository is still supported. The last commit was 5 months ago.

MikeMcC399 avatar Feb 22 '23 17:02 MikeMcC399