Improve search highlighting/phrase replacing.

Search highlighting ignores HTML elements entirely now, and phrase
replacement happens before glossary/wikipedia, so that the phrases
are already links which are correctly detected.