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

Exit code 1, but does not report any issues with -v passed when []() syntax is used instead of []() for links #410

Open
suricactus opened this issue Feb 18, 2025 · 3 comments

Comments

@suricactus
Copy link

suricactus commented Feb 18, 2025

Pretty much the title.

Create a markdown file that defines a "link" like this: (link)[https://github.com] . Instead of showing "invalid link syntax" for a given file, or anything, I get a silent exit code 1.

Note that if a file has no links to be checked and I pass the verbose mode, I get:

FILE: markdown.md
  No hyperlinks found!

  0 links checked.

But when in this case I just got:

FILE: markdown.md

Without any further explanations if any links were checked.

Took me a while to discover what went wrong.

Not related to #369 , but haven't checked against #398 .

@smainil
Copy link

smainil commented Feb 18, 2025

Are you using a config file ? Which version are you using ?

@suricactus
Copy link
Author

I tried with and without config file, tried all the version above v3.11.2 till latest.

@smainil
Copy link

smainil commented Feb 19, 2025

I was able to reproduce the issue and have a little bit more datas

An error is raised here https://github.com/tcort/link-check/blob/3263c3b65917375c209928ca2b1ad4102824da36/index.js#L21 when trying to convert what's supposed to be an URL to en URL object

`
λ NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_NO_WARNINGS=1 npx markdown-link-check -v -p docs/test.md

FILE: docs/test.md
TypeError: Invalid URL
at new URL (node:internal/url:816:29)
at linkCheck (xxx/wiki/node_modules/link-check/index.js:21:47)
at xxx/wiki/node_modules/markdown-link-check/index.js:158:9
at /xxx/wiki/node_modules/async/dist/async.js:247:13
at replenish (xxx/wiki/node_modules/async/dist/async.js:447:21)
at xxx/wiki/node_modules/async/dist/async.js:452:13
at _asyncMap (xxx/wiki/node_modules/async/dist/async.js:245:16)
at Object.mapLimit (xxx/wiki/node_modules/async/dist/async.js:2092:16)
at Object.awaitable [as mapLimit] (xxx/wiki/node_modules/async/dist/async.js:212:32)
at markdownLinkCheck (xxx/wiki/node_modules/markdown-link-check/index.js:98:11) {
code: 'ERR_INVALID_URL',
input: 'https://github.com%5D',
base: 'file:///xxx/wiki/docs'
}
`

If you have a look to the logs here above, it has discovered your "wrong" url but as it's not in the right format it kept the ] at the end (%5D). I don't know how it works in details and why it's not displayed to the console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants