Fix incomplete last commit and add escaping of html. Thanks to Julien Rouhauld for the patch.