parsing messages into HTML