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

Add native globbing of files #40

Open
nschonni opened this issue May 16, 2018 · 12 comments
Open

Add native globbing of files #40

nschonni opened this issue May 16, 2018 · 12 comments
Labels
enhancement New feature request or implementation help needed I need someone to have a look at this, review, provide inputs, help to fix,...

Comments

@nschonni
Copy link
Contributor

The example in the repo works on systems that have find, but not so much in a Windows world https://github.com/tcort/markdown-link-check#check-links-from-a-local-markdown-folder-recursive
Maybe use https://www.npmjs.com/package/glob to try and parse the file parameter as a file glob and iterate over it in the CLI.

@timmkrause
Copy link

timmkrause commented May 16, 2018

Like the idea. Having the same „problem“ but found a way (guess there are more) to work around it.
I am using „cmder“ to have find available.

But yes, native support would be great and make the usage much easier for recursive executions.

@timmkrause
Copy link

This would also enable statistic counters across multiple files: Number of errors, error percentage etc.

@timmkrause
Copy link

timmkrause commented May 23, 2018

Will start with this topic when #41 has been accepted. My next time slot is Friday afternoon, I hope the changes have been merged then.

@nschonni
Copy link
Contributor Author

It may be worth looking at how https://github.com/igorshubovych/markdownlint-cli does it

@timmkrause
Copy link

timmkrause commented Jun 5, 2018

Now working on it but I won't finish it today.

image

@timmkrause
Copy link

Sorry. Have been pretty busy the last 2 weeks and now I am 3 weeks on vacation. Will get back to this topic if nobody foreruns me.

Current state: https://github.com/timmkrause/markdown-link-check/tree/feature/globs

There are still a few issues (and a critical one regarding async) that needs to be fixed. I was also thinking about moving the logic into separate "analyzers" like the protocol handlers in link-check.

Feel free to finish this work, otherwise I will get back to it in the mid of July.

@nvuillam
Copy link
Contributor

Hi, any news about this PR ?
To enhance integration off markdown-link-check within MegaLinter, it would help a lot to be able to run:

markdown-link-check file1.md file2.md file3.md

Thansk a lot :)

@nschonni
Copy link
Contributor Author

nschonni commented Apr 3, 2022

Think this was mostly done in #179
@tcort the 2 outstanding cleanups

@iamtodor
Copy link

@nschonni I'd also suggest along with node_modules you can consider adding .history dir to be excluded from the VS-Code plugin https://marketplace.visualstudio.com/items?itemName=xyz.local-history

@vchelamkuri
Copy link

Any update on the support for native globbing?

@CanadaHonk
Copy link
Contributor

  • an -i/--ignore flag to excluded files from the globs. EX: markdown-link-check "**/*.md" -i node_modules/. There are probably other use cases, but primarily needed so it can glob at the root, without picking up files in node_modules. Alternately a default ignore for node_modules might be enough

See also #102

@per1234
Copy link

per1234 commented Dec 1, 2023

Think this was mostly done in #179

I'd be happy to be wrong, but I don't think so. Although a very important advancement, #179 did not add the globbing support requested here at all.

If I run the command @nschonni's comment implies as being supported following #179, I simply get the error we would expect if the "globstar" globbing syntax was not supported:

$ markdown-link-check --version
3.11.2

$ markdown-link-check "**/*.md"
node:fs:1583
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, stat '**/*.md'
    at Object.statSync (node:fs:1583:3)
    at Command.<anonymous> (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/markdown-link-check:79:38)
    at Command.listener [as _actionHandler] (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/node_modules/commander/lib/command.js:482:17)
    at /mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/node_modules/commander/lib/command.js:1283:65
    at Command._chainOrCall (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/node_modules/commander/lib/command.js:1177:12)
    at Command._parseCommand (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/node_modules/commander/lib/command.js:1283:27)
    at Command.parse (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/node_modules/commander/lib/command.js:909:10)
    at getInputs (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/markdown-link-check:91:7)
    at main (/mnt/1c0bd221-e077-452c-b688-160dc700c122/git/tooling-project-assets/node_modules/markdown-link-check/markdown-link-check:235:20) {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: '**/*.md'
}

@nschonni do you get a different result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request or implementation help needed I need someone to have a look at this, review, provide inputs, help to fix,...
Projects
Issues progress
  
High priority
Development

No branches or pull requests

8 participants