请问HN:这个富文本数据模型是否有先前的相关技术?
我为一个桌面文字处理器构建了一个丰富文本数据模型,使用Python实现,基于持久的平衡n叉树,并缓存权重以实现O(log n)的索引转换。该文档模型仅使用四种元素类型:文本、容器、单一元素和组——其中组纯粹是结构性的(用于平衡),在文档中没有语义意义。
单个元素是不可变的;插入和取出操作返回新的树,而不是修改旧的树。这确保了只要旧树存在,旧索引就保持有效。
我了解Ropes、Finger Trees和ProseMirror的扁平索引模型。是否有我应该了解的相关先前研究,特别是针对具有这些特性的丰富文本文档模型?
查看原文
I've built a rich text data model for a desktop word processor in Python, based on a persistent balanced n-ary tree with cached weights for O(log n) index translation. The document model uses only four element types: Text, Container, Single, and Group — where Group is purely structural (for balancing) and has no semantic meaning in the document.
Individual elements are immutable; insert and takeout return new trees rather than mutating the old one. This guarantees that old indices remain valid as long as the old tree exists.
I'm aware of Ropes, Finger Trees, and ProseMirror's flat index model. Is there prior art I should know about — specifically for rich text document models with these properties?