tcort / markdown-link-check

checks all of the hyperlinks in a markdown text to determine if they are alive or dead
ISC License
580 stars 117 forks source link

anchor link checking is broken #225

Open OmarTawfik opened 1 year ago

OmarTawfik commented 1 year ago

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 commented 1 year ago

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

MikeMcC399 commented 1 year ago
MikeMcC399 commented 1 year ago

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.