18 ms·
In the era of DOM documents (see notion, gitbook) I very often resort to attributed strings to do magic stuff with text parsing and manipulation. It’s such an e
by yuchi 3y ago
In the era of DOM documents (see notion, gitbook) I very often resort to attributed strings to do magic stuff with text parsing and manipulation. It’s such an elegant structure and I don’t understand why is so unknown.
Incredible article btw
- papereditor 3y agoThank you!
- LikeAnElephant 3y agoDo you have an example? I’d love to learn more!
- yuchi 3y agoLet’s say you have a rich text where you want to highlight all occurrences of some token or syntax. When you have tree data structures you cannot use regexps or a simple parsers, since the full text may be split in different nodes. With attributes strings it’s trivial, you just need to move attributes accordingly and to normalize stuff at the end.
- Ezhik 3y agoI wonder if there are any web rich text editor components that use attributed strings? Tired of the DOM.