I have been playing since a week or so with the Text System on Cocoa/GNUstep... it's not immediately easy to understand, but it's really nice and powerful :-)
It handles automatically lots of things, you can redefine many things too (create specific layout manager to change the way the text is displayed, eg, to "flow" around an image, etc.)..
For instance, you're supposed to work with NSTextStorage, which contains the content you're editing, and which is supposedly an attributed string (a string plus related attributes -- fonts, links, attachments, etc), and you edit it via a NSTextView. But what if you want MORE than edit an attributed string ? like, say, edit some structured content ?
Well in fact,the answer is to create a subclass of NSTextStorage that will answer the base methods (just four) of NSTextStorage -- it's in fact a class cluster. So the idea is simply to have on one side your structured document (in my case, a simple array of "Section" objects, containing (optionally) a title and a content), and to have a NSTextStorage that will actually serve as a gateway between the text system (which expect a simple NSAttributedString) and your own structured model... Pretty cool :-) and that way you benefit of all the niceties of the text system..
The above screenshot is my current editor (which btw I wrote under Cocoa, and recompiled this evening on GNUstep), the button is there to define a selected text as a title.