How does the toolbar button work?
This was a deceptively difficult feature to implement. I eventually decided on a divide-and-conquer strategy. First, the HTML is split into an array of strings, splitting across whitespace, breaks, and tags (to avoid linking text that’s in a tag). Then, this array is run through using all the defined regular expressions, and a final set of all matching text is built. This final set is then run through the original HTML, doing a regex replace. Currently, this does not account for numbers that are already linked, and it can produce false positives (e.g., order numbers that look like tracking numbers). I may fix the linking problem in the future, but nothing can be done about the false positives.