Strip text fragment option
Closed this issue · 3 comments
adam-lynch commented
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:
- https://example.com/page#:~:text=hello -> https://example.com/page
- https://example.com/page#main:~:text=hello -> https://example.com/page#main
- https://example.com/page#main -> https://example.com/page#main
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
Yeah, good idea. PR welcome.
Example of what's required to add an option: 18effbe
adam-lynch commented
So it would be a new option? E.g.
normalizeUrl('...', {stripHash: false, stripTextFragment: true});
sindresorhus commented
Correct