1. A non-transitory computer-readable storage medium having encoded thereon data representing a model of a document, the document model comprising: a document object model (DOM); a one-dimensional character string portion that includes characters of the document in an order in which they appear in the document; a map of styles portion that includes markers that correspond to changes in styles in the document, and pointers to the character string, wherein the pointers define locations along the character string at which the changes in styles are to occur and define style runs between matched markers; one or more external references to objects outside the document model, the external references including identifiers for the objects and pointers to the character string indicating where in the character string the object will appear; wherein the objects are images, lists or tables that are outside the document mode; wherein reversing style changes are represented in the map of styles by a paired set of markers that are correlated with each other in the map of styles; and wherein the markers in the paired set are arranged so that, if text is added in the document between the markers, the pointer for one of the markers shifts by an integer equal to a number of characters in the added text.