Better handling of spaces on converting text to html