4 ms·
Highlighting URLs with JavaScript
Sometimes you want to show the user a URL that is nicely visually structured. This happens especially in cases where it is important to focus on e.g. query parameters of an URL. I had this need and so I created urlhighlight, a very little (151 loc) JavaScript function that takes a URL as a parameter and returns HTML that wraps components of that URL. These components can be then styled in CSS.