Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JustinBeckwith/linkinator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.11.1
Choose a base ref
...
head repository: JustinBeckwith/linkinator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.11.2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 26, 2020

  1. Copy the full SHA
    679d64f View commit details

Commits on Dec 28, 2020

  1. Copy the full SHA
    c752724 View commit details
Showing with 18 additions and 2 deletions.
  1. +13 −1 README.md
  2. +5 −1 src/cli.ts
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -263,7 +263,7 @@ async function complex() {
complex();
```

## Notes
## Tips & Tricks

### Using a proxy
This library supports proxies via the `HTTP_PROXY` and `HTTPS_PROXY` environment variables. This [guide](https://www.golinuxcloud.com/set-up-proxy-http-proxy-environment-variable/) provides a nice overview of how to format and set these variables.
@@ -276,6 +276,18 @@ $ linkinator "**/*.md" --markdown

Without the quotes, some shells will attempt to expand the glob paths on their own. Various shells (bash, zsh) have different, somewhat unpredictable behaviors when left to their own devices. Using the quotes ensures consistent, predictable behavior by letting the library expand the pattern.

### Debugging
Oftentimes when a link fails, it's an easy to spot typo, or a clear 404. Other times ... you may need more details on exactly what went wrong. To see a full call stack for the HTTP request failure, use `--verbosity DEBUG`:
```sh
$ linkinator https://jbeckwith.com --verbosity DEBUG
```

### Controlling Output
The `--verbosity` flag offers preset options for controlling the output, but you may want more control. Using [`jq`](https://stedolan.github.io/jq/) and `--format JSON` - you can do just that!
```sh
$ linkinator https://jbeckwith.com --verbosity DEBUG --format JSON | jq '.links | .[] | select(.state | contains("BROKEN"))'
```

## License

[MIT](LICENSE.md)
6 changes: 5 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -128,7 +128,11 @@ async function main() {
serverRoot: flags.serverRoot,
};
if (flags.skip) {
opts.linksToSkip = flags.skip.split(' ').filter(x => !!x);
if (typeof flags.skip === 'string') {
opts.linksToSkip = flags.skip.split(' ').filter(x => !!x);
} else if (Array.isArray(flags.skip)) {
opts.linksToSkip = flags.skip;
}
}
const result = await checker.check(opts);
const filteredResults = result.links.filter(link => {