Fix issues with adding word breaks and highlighting

Prior to this change, the `add_word_breaks` utility method would attempt to insert `<wbr>` tags at certain intervals in text (when no natural word breaks occurred). However, this caused problems when there were highlighting markers (`<mark>`) because `<wbr>` tags could get inserted inside `<mark>` tags, causing funky (and invalid) nested tags.

This PR addresses the issue by only adding word breaks outside of HTML tags, and adds some tests around the behavior.

Closes #2415.