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 --exclude-link-text=unavailable option? #101

Open
gitressa opened this issue Jun 4, 2020 · 8 comments
Open

Add --exclude-link-text=unavailable option? #101

gitressa opened this issue Jun 4, 2020 · 8 comments

Comments

@gitressa
Copy link
Contributor

gitressa commented Jun 4, 2020

In some cases, you need to keep a link, even though it is broken, and perhaps add "(unavailable)" to the link text, like this: link text (unavailable).

However, you don't want this known dead link to get checked, so it would be great with an option like --exclude-link=unavailable, which skips links with link texts containing this string. Is this possible?

@dantleech
Copy link
Owner

dantleech commented Jun 4, 2020

I think you can already use --exclude-url which accepts a regex? (e.g. I've used --exclude-url=logout to avoid clicking the logout link)

@gitressa
Copy link
Contributor Author

gitressa commented Jun 4, 2020

Yes, that works fine. But I want to target the link text, not the link. Perhaps check my example again? :-)

@gitressa
Copy link
Contributor Author

gitressa commented Jun 8, 2020

... or do you mean that --exclude-url can also target the link text, not just the URL?

@dantleech
Copy link
Owner

No, you can't target the link text currently, do that would be a prospective new feature.

@gitressa
Copy link
Contributor Author

gitressa commented Jun 8, 2020

Thanks for clarifying. Do you think it would be worth considering adding such a feature? A pretty good argument and use case for it, is if you have hundreds of links, which you need to keep as reference, though the target link no longer exist. These links don't need to get checked, and in a sense give false positives.

@dantleech
Copy link
Owner

Possibly, but it fits into the category of filtering, could also support CSS selectors (?) or XPath to capture all scenarios.

@gitressa
Copy link
Contributor Author

gitressa commented Jun 8, 2020

Also adding support CSS selectors or XPaths as filters, on top of the link text would expand the flexibility, so that would be nice as well. So something like adding both --exclude-link-text and --exclude-class options?

@dantleech
Copy link
Owner

Yes, you could filter on any link property with --exclude-link="contains(text(), 'Foobar')" or similar.

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