3 ms·
One of unresolved questions of rich text in my mind is what to do with these markup “codes”, explicit or hidden, because while the (usually) nested open/close s
by mananaysiempre 5y ago
One of unresolved questions of rich text in my mind is what to do with these markup “codes”, explicit or hidden, because while the (usually) nested open/close structure is a non-terrible way for describing formatting in plain text, it is IMO a completely unnatural model (mental or programmatic) of describing rich text by itself, not backed by marked-up plain text. This is apparent in abstraction leaks like the one you describe, but it also has a way of making your life really miserable as soon as you want to reason about transformations of documents, like in a collaborative editor or just a HTML-based editor.
In fact, both Google Wave (IIRC, not going to look up the reference right now) and the Medium editor (https://medium.engineering/why-contenteditable-is-terrible-122d8a40e480 https://medium.engineering/why-contenteditable-is-terrible-1...) represent inline formatting as a bucket of non-nested “spans”, because while this still doesn’t yield a unique representation of what you want to call rich text, it gets much easier to pick a canonical representative for each class of equivalent representations that doesn’t get completely upturned by localized editing operations.
Even the text editor example in the GoF book just assigned each character a (shared, CoW) style object... Does anyone actually do it this way?
- geocar 5y ago> Even the text editor example in the GoF book just assigned each character a (shared, CoW) style object... Does anyone actually do it this way? Emacs does. It has something called "text properties" https://www.emacswiki.org/emacs/TextProperties#text_property https://www.emacswiki.org/emacs/TextProperties#text_property Colorforth also works this way. https://colorforth.github.io/parsed.html https://colorforth.github.io/parsed.html The complication arises when you insert text: Users generally prefer to insert a letter between two bold characters and have the word processor "assume" the user meant to type boldface, rather than push a button to put the insert-function into "create bold letters" mode.