docs icon indicating copy to clipboard operation
docs copied to clipboard

[CI] Check relative links are correct

Open ee7 opened this issue 4 years ago • 5 comments

Not a priority for now, but it would be nice to have a script that does something like:

  • For every markdown file:
    • For every link:
      • If it's a relative link:
        • Check that it resolves to a file in this repo, using the logic that the website uses (no .md extension, etc)
        • Bonus: check that any anchor is correct too

ee7 avatar Jun 25 '21 12:06 ee7

Could probably use Erik's link check tool for this again: https://github.com/exercism/v3/blob/main/.github/workflows/valid-links.yml

SaschaMann avatar Jun 25 '21 13:06 SaschaMann

I've recently found lychee: https://github.com/lycheeverse/lychee This tool is much more full-featured than my tool and a lot faster (it's built in Rust).

ErikSchierboom avatar Aug 24 '21 07:08 ErikSchierboom

Nice. The challenge here is probably the fact that relative links are relative in the context of the website; the therefore the race-condition of new links being added but not merged, so not appearing in the website.

I feel like we probably need to build out the array of all routes from the config.jsons, and then check against that?

iHiD avatar Aug 24 '21 11:08 iHiD

Yeah, I think that's probably best

ErikSchierboom avatar Aug 24 '21 12:08 ErikSchierboom

Some actions that we might be able to adapt:

  • https://github.com/lycheeverse/lychee-action
  • https://github.com/JustinBeckwith/linkinator-action

ee7 avatar Nov 30 '22 14:11 ee7