Handle html_safe input/output with escaping.

* Escape strings not marked html_safe?
* Mark outgoing strings html_safe
Merge branch 'feature/image_replacement' into polar