moved highlightTextAndHtmlEscape from class method to top level function.