sindresorhus / normalize-url

Normalize a URL
MIT License
837 stars 123 forks source link

Strip text fragment option #129

Closed adam-lynch closed 3 years ago

adam-lynch commented 3 years ago

https://web.dev/text-fragments/. Text fragments are currently supported in Edge, Chrome, and some mobile browsers. Google use/used them in search results.

Expected behaviour:

I currently need to do this but I'm not sure many will so maybe it's not worth having to maintain an option for it.

sindresorhus commented 3 years ago

Yeah, good idea. PR welcome.

Example of what's required to add an option: https://github.com/sindresorhus/normalize-url/commit/18effbe37a89f86841b8a1e24200ee3631719214

adam-lynch commented 3 years ago

So it would be a new option? E.g.

normalizeUrl('...', {stripHash: false, stripTextFragment: true});
sindresorhus commented 3 years ago

Correct