Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remark-validate-link warns about valid link #58598

Open
amcasey opened this issue Feb 4, 2022 · 0 comments · May be fixed by remarkjs/remark-validate-links#65
Open

remark-validate-link warns about valid link #58598

amcasey opened this issue Feb 4, 2022 · 0 comments · May be fixed by remarkjs/remark-validate-links#65

Comments

@amcasey
Copy link
Contributor

amcasey commented Feb 4, 2022

The readme(s) use the GH permalink https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1253faabf5e0d2c5470db6ea87795d7f96fef7e2/types/history/v2/tsconfig.json in an example. It appears that remark-validate-link (powered by hosted-git-info) recognizes that this is from our GH repo and concludes that the appropriate file to validate is types/history/v2/tsconfig.json, which does not exist.

remark-validate-link doesn't support much configuration, but it seems possible that a .remarkc file could specify its hostname setting to override the inferred value and prevent remark-validate-link from attempting to validate absolute paths as though they were relative. Note, however, that doing so would cause it to miss bad URLs like https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json (which actually doesn't exist). The correct fix would probably require passing a setting to hosted-git-info, possible nocommitish.

amcasey added a commit that referenced this issue Feb 4, 2022
It appears that `remark-validate-link` uses `hosted-git-info` to convert our GH permalink into a relative link (since it shares a prefix with our GH repo) and then warns that the relative link is dangling.  This change uses URL encoding to defeat the tool's simple prefix matching.

Filed #58598 to investigate a real solution.
martin-badin pushed a commit to martin-badin/DefinitelyTyped that referenced this issue Feb 23, 2022
It appears that `remark-validate-link` uses `hosted-git-info` to convert our GH permalink into a relative link (since it shares a prefix with our GH repo) and then warns that the relative link is dangling.  This change uses URL encoding to defeat the tool's simple prefix matching.

Filed DefinitelyTyped#58598 to investigate a real solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant