trim whitespace so parseHTML only contains HTML