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

Anchor link checking fails

Open MikeMcC399 opened this issue 1 year ago • 6 comments

markdown-link-check reports a 404 error when checking a correctly formatted link such as

[Good regular link](#link1)
# link1

This is a regression from [email protected].

markdown-link-check version

3.12.1

Operating system

Ubuntu 22.04.4 LTS

Node.js version

v20.11.1 LTS

Steps to reproduce

Execute:

mkdir md-link-test
cd md-link-test
npm install markdown-link-check

Create a Markdown file test.md with the following contents

| Link source                 | Should | 3.8.7    | 3.11.2   | 3.12.1   |
| --------------------------- | ------ | -------- | -------- | -------- |
| [Good regular link](#link1) | Pass   | Pass     | Pass     | **Fail** |
| [Good link in HTML](#link2) | Pass   | Pass     | **Fail** | **Fail** |
| [Bad link](#link3)          | Fail   | **Pass** | Fail     | Fail     |

**Targets**

# link1

<a id='link2'>Link 2</a>

Execute:

npx markdown-link-check test.md

Note the failure: [✖] #link1 → Status: 404

Test with 3.11.2

Execute:

npm install [email protected]
npx markdown-link-check test.md

Note the correct success of testing link1: [✓] #link1

Logs from 3.12.1

$ npx markdown-link-check test.md

FILE: test.md
  [✖] #link1
  [✖] #link2
  [✖] #link3

  3 links checked.

  ERROR: 3 dead links found!
  [✖] #link1 → Status: 404
  [✖] #link2 → Status: 404
  [✖] #link3 → Status: 404

Related issue

  • #195

MikeMcC399 avatar Mar 11 '24 17:03 MikeMcC399

This is a showstopper for updating to markdown-link-check@latest (3.12.1).

MikeMcC399 avatar Mar 11 '24 17:03 MikeMcC399

It is a regression in https://github.com/tcort/markdown-link-check/commit/2eb21a170f8a9d3f4babd3567818a1f6b641da66

IMO it is dependency markdown-link-extractor.

dklimpel avatar Mar 11 '24 17:03 dklimpel

@dklimpel

It is a regression in 2eb21a1

IMO it is dependency markdown-link-extractor.

Thank you for locating the source of the regression. I can confirm that the issue also exists in 3.12.0. You would need to add the --ignore workaround to demonstrate this, i.e.:

npx markdown-link-check test.md --ignore nothing

For some reason, the CI test has the hash-links test being skipped, so anchors are not tested:

https://github.com/tcort/markdown-link-check/blob/c8c394cb9505893d7c8b91dc3c492801824331d9/test/markdown-link-check.test.js#L343-L354

MikeMcC399 avatar Mar 11 '24 17:03 MikeMcC399

It was broken.

https://github.com/tcort/markdown-link-check/commit/98ba6bfd6d14147a7d63e9f52ad6352428a400e6

:-/

dklimpel avatar Mar 11 '24 18:03 dklimpel

Reason is a missing upstream feature: https://github.com/tcort/markdown-link-extractor/issues/24

  • added: https://github.com/tcort/markdown-link-extractor/pull/25
  • reverted: https://github.com/tcort/markdown-link-extractor/commit/685474fb0b41941aaaa340f228d12f91aa8d5cce

dklimpel avatar Mar 11 '24 19:03 dklimpel

I also ran into this issue today on 3.12.1.

AvinZarlez avatar Apr 05 '24 17:04 AvinZarlez

Is there any hope that this fundamental issue will be fixed? It seems like the repository is hardly being maintained at this current time.

MikeMcC399 avatar May 20 '24 12:05 MikeMcC399

  • This issue is no longer reproducible in release v3.12.2, possibly due to PR https://github.com/tcort/markdown-link-check/pull/312

MikeMcC399 avatar May 23 '24 06:05 MikeMcC399