Parser 2011/Annotated text

Annotated text separates a stream text from a set of annotations which are applied to various sequences of characters. For instance, rather than

This is some text

in annotated text that might be

[ [ [ 'italic', 5, 14 ], [ 'bold', 8, 11 ] ], 'This is some text' ] ]

This has advantages for a real-time collaborative editor based on Operational Transforms since it's easier to compute the result of various edits received out-of-order. Annotations are always finite in size, and can even overlap -- although to render in HTML, they must be broken into nodes and subnodes.