wjdp / htmltest

:white_check_mark: Test generated HTML for problems
MIT License
323 stars 54 forks source link

Add an option to ignore domains #151

Open alexppg opened 4 years ago

alexppg commented 4 years ago

Is your feature request related to a problem? Please describe. If a domain goes down for whatever reason and you dont't want/can't update the urls, you have to add all the urls to the configuration file.

Describe the solution you'd like It would be a lot easier if you could just have a list of domains to ignore.

Describe alternatives you've considered Adding the urls manually can make it work, but you'll may end with a config file of hundreds of lines.

Simran-B commented 3 years ago

IgnoreURLs - Array of regexs of URLs to ignore.

Since it accepts regular expressions, this is already possible, e.g.:

IgnoreURLs:
  - ^https?://(www\.)?example\.org\b

The above regex should match all of the following URLs:

wjdp commented 3 years ago

You don't technically need regex for this but the result isn't as good. If you don't want to check example123.com. This will match all links containing that string:

IgnoreURLs:
  - example123.com

You could add a scheme but that would ignore a url like https://anothersite.test/https://example123.com which you'd probably want to catch using an HTML tester.

The docs aren't very clear on this point. I'll update them with @Simran-B 's solution. I'm tempted to add an IgnoreDomains setting which does the legwork for you though.