Comments (9)
Or use extended globs to check all Markdown files in all directories below the current one recursively:
lychee -v '**/*.md'
Note the required single quotes since lychee itself does the file matching here as extended globs (**
to match directories recursively) are not supported by default in most shells.
from lychee.
We use glob for that. According to the docs about patterns,
** matches the current directory and arbitrary subdirectories. This sequence must form a single path component, so both a and b are invalid and will result in an error. A sequence of more than two consecutive * characters is also invalid.
This also explains why **.md
doesn't work: **
can only stand on its own.
Just checked if lychee was picking up the current directory when using a glob.
Created the following file tree:
❯❯❯ tree
.
├── 1
│ └── bar.md
├── 2
│ ├── 3
│ │ └── bla.md
│ └── baz.md
└── foo.md
3 directories, 4 files
Here's the glob test for ls
:
ls **/*.md
1/bar.md 2/3/bla.md 2/baz.md foo.md
And here's the lychee command:
❯❯❯ lychee --verbose --progress '**/*.md'
✅ http://foo.com/ [200 OK]
✅ http://bla.com/ [200 OK]
✅ http://baz.com/ [200 OK]
✅ http://bar.com/ [200 OK]
📝 Summary
-------------------
🔍 Total: 4
✅ Successful: 4
⏳ Timeouts: 0
🔀 Redirected: 0
👻 Excluded: 0
🚫 Errors: 0
So it did pick up http://foo.com. 😃 Also works without the quotes around **/*.md
on zsh.
from lychee.
Yeah, just use multiple arguments:
lychee --verbose 1/*.md 2/*.md
There is no limit on the maximum number of inputs. You can also mix inputs from different sources:
lychee --verbose 1/*.md 2/*.md https://endler.dev
This checks the markdown files in the folders 1 and 2 as well as all links on endler.dev. 😃
from lychee.
@Wuliyuanulb can we close this or do you have any follow-up questions?
from lychee.
I have a question on this one. How do I specify a root directory under which I want all the markdown files scanned for broken link?
from lychee.
lychee -v '/path/to/**/*.md'
or
cd /path/to
lychee -v '**/*.md'
with /path/to
being the path to that root directory.
Btw @mre is **
expanded to .
(current directory) as well or why does it work? I once tried **.md
to assure that everything including the current dir is checked, but that does not work. **/*.md
does exactly this, even that it looks like it scans only sub directories recursively while skipping the current dir. **
=> .
would make sense, but it was not intuitive to me in the first place 😄.
from lychee.
That should answer all questions and we can close this I guess. 😄
from lychee.
Also works without the quotes around **/*.md on zsh.
True, but if the shell did not support it or has **
support disabled (default in bash), the shell could theoretically expand *
and lychee would then get a glob with *
pre-expanded, hence won't find all matches anymore. It's unlikely that there is a file path with literal **
, but I like to be explicit when spamming shell commands into the world 😄.
from lychee.
Oh yeah, absolutely. I recommend to always quote it so that there are no differences with varying environments. Thanks for pointing that out. 👍
from lychee.
Related Issues (20)
- a.textContent is checked even if the text is shortened for the link HOT 1
- Allow option to ignore failures in cache HOT 6
- too many requests error on github profile links even if use --github-token HOT 4
- Globs ignore `exclude_path` HOT 1
- Non-link footnotes in markdown are reported as broken links. HOT 9
- Too many redirects HOT 4
- Update pulldown-cmark
- Support Extism WASM plugins
- Does it support scanning Vue files HOT 3
- Issues checking anchors/fragments in markdown files HOT 3
- Response chain
- Missing 0.15.x releases on docker hub HOT 1
- optionally fix document when URL are redirected HOT 6
- Converting Uri to Url string HOT 2
- Feature request: add FlareSolverr solver to bypass CloudFlare protection HOT 5
- custom Header not sent HOT 7
- Consider renaming `--format` to `--report` HOT 5
- Comments to ignore links HOT 1
- Consider renaming `fail_map` to `error_map` HOT 3
- Screencast SVG incurs a rendering burden on the browser HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lychee.