split begin and end markup