gaurav-nelson / github-action-markdown-link-check

Check all links in markdown files if they are alive or dead. 🔗✔️
MIT License
407 stars 76 forks source link

Title Links Not Working in 1.0.14 #176

Closed niall-byrne closed 1 year ago

niall-byrne commented 1 year ago

In the latest release, I notice links to title sections are now marked as broken. ie.

[Dependencies](#Dependencies)

# Dependencies
This markdown example has no dependencies.

I can work around this with configuration, but I wanted to check if this was the desired behaviour?

gaurav-nelson commented 1 year ago

Thank you @niall-byrne, Can you verify this with v1.0.15 ?

philrz commented 1 year ago

@gaurav-nelson: I can confirm this does indeed happen with v1.0.15. After seeing my prior issue https://github.com/gaurav-nelson/github-action-markdown-link-check/issues/170 was fixed in v1.0.15, I went to point at that version in my production config only to find the linkchecks of anchor links like these were broken, so that's when I searched & found this issue. I've just reproduced it in my test repo https://github.com/philrz/linkcheck: The check for [Dependencies](#Dependencies) passed ok when I had it pointing @v1 but it fails when pointing @1.0.15. I notice that @niall-byrne's paste shows what looks to be incorrect syntax [Dependencies][#Dependencies] (two sets of square brackets) but I have it failing with [Dependencies](#Dependencies).

gaurav-nelson commented 1 year ago

@philrz I think the correct markdown anchor should be:

[Dependencies][#dependencies]
...
...
# Dependencies
This markdown example has no dependencies.

Because href is always generated like that (d vs D). Its working fine on GitHub because they maybe using some scripts.

Can you recheck with this change?

philrz commented 1 year ago

@gaurav-nelson: Ah yes, thanks for spotting the importance of the capitalization. I did the proposed recheck and indeed now that it's a lowercase d the checker @1.0.15 is passing with that test README. So, that's great!

However, I've still got a problem with my production markdown, and unfortunately it doesn't seem to be a problem with capitalization. I've copied the markdown into my test repo at https://github.com/philrz/linkcheck/blob/main/zng.md if you're up for taking a look. The output of the Actions run with verbose mode enabled shows:

FILE: ./zng.md
  [✓] https://avro.apache.org/ → Status: 200
  [✓] https://en.wikipedia.org/wiki/Apache_Parquet → Status: 200
  [✓] https://developers.google.com/protocol-buffers → Status: 200
  [✓] https://kafka.apache.org/ → Status: 200
  [✓] #21-types-frame → Status: 200
  [✖] #22-values-frame → Status: 404
  [✖] #23-control-frame → Status: 404

  7 links checked.

  ERROR: 2 dead links found!
  [✖] #22-values-frame → Status: 404
  [✖] #23-control-frame → Status: 404```

What's strange is that if you look in the doc you'll see these links all appear right next to each other:

* [types frame](#21-types-frame),
* [values frame](#22-values-frame), or
* [control frame](#23-control-frame).

And the section headers for each are:

### 2.1 Types Frame
### 2.2 Values Frame
### 2.3 Control Frame

And for some reason it thought the Types Frame one was ok but the other two were a 404, but I can't for the life of me see why they're treated differently. I'd appreciate any insight you might have. Thanks!

gaurav-nelson commented 1 year ago

Thank you @philrz I ran through that file locally with markdown-link-check and got the same result. I'm not sure what is wrong here, but this issue is with the underlying markdown-link-check library and not the GitHub action. I suggest to close this one and create an issue at https://github.com/tcort/markdown-link-check/issues

philrz commented 1 year ago

Thanks @gaurav-nelson. I've opened https://github.com/tcort/markdown-link-check/issues/250. Will see what they say.

niall-byrne commented 1 year ago

I'll close this issue given the upstream library is being investigated.