callumlocke / json-formatter

Makes JSON easy to read.
https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en
BSD 3-Clause "New" or "Revised" License
3.8k stars 878 forks source link

URL testing doesn't work for relative URLs #146

Open bennosom opened 5 years ago

bennosom commented 5 years ago

https://github.com/callumlocke/json-formatter/blob/e494f29f613d6d682e67b4acbc571812bf1638b5/extension/js/background.js#L266

The assumption that each URL is absolute excludes many use cases. It would be better if relative links were also recognized as such.

My suggestion would be to leave it to the user how URLs are recognized. You could let the user specify a RegEx pattern to check the string. If no pattern is provided, than fall back to the old way.

Cheers!