Implement PreserveEntities option.

Ported from https://github.com/w3c/tidy-html5