merge markup in document