Make sure special characters in the text are proper HTML entities

Not sure what the best place for the HTML entities call is, perhaps the actual `addElem()` function is better suited.