I think your comment went missing because I rebased the branch to correct a spelling mistake in the commit message. I didn't realise that it would erase your message (though I guess I should've if I'd thought about it).
Anyway, I simplified the html detection a little and now broken tags and self-closing tags also get escaped. I hope that this solves all the situations. I couldn't think of any more edge cases
I think your comment went missing because I rebased the branch to correct a spelling mistake in the commit message. I didn't realise that it would erase your message (though I guess I should've if I'd thought about it). Anyway, I simplified the html detection a little and now broken tags and self-closing tags also get escaped. I hope that this solves all the situations. I couldn't think of any more edge cases