Repair and clean HTML structure