There is lack of possibility to disable mark ranking, for example, some option in SchemaSpec or direct specification of rank in MarkSpec. I don’t understand why ranking is needed at all, I have set the same rank for all marks in my project through the patch mechanism and haven’t noticed any problems, but I’d like to have this functionality out of the box without using such workarounds.
You mean you’re mutating the MarkType
objects to reset their ranks? Why on earth are you doing that?
Yes, right when creating a MarkType, I assign a zero rank. I use the editor to edit XML with mixed content, and if there are intersections of elements, then after parsing they are shuffled according to the order in the schema, i.e. if you just open and save such a file, you get unnecessary changes, and besides, they look excessively verbose. For example, if the tag <i>
has a rank higher than <b>
, then the string "Lorem <b>ipsum <i>dolor</i> sit</b> amet"
turns into "Lorem <b>ipsum </b><i><b>dolor</b></i><b> sit</b> amet"
.
Sorry, but what you are doing isn’t safe in this system, and will break more things than it solves. The model intentionally defines marks in such a way that a given document can be expressed in one, and only one, way. Comparing of nodes, among other things, depends on this stable ordering.
You could define a custom serializer that simplifies overlapping marks, when possible, but the thing you’re doing now is not supported and will not be supported.