Is there a way to determine Mark actions when another mark is applied to the same text?

Hi there! I’ve faced a problem with using default marks with my custom marks:

if I use “strong” and “em” default marks, one will be wrapped around the other one, depending on the order you apply them at:

<strong>Lorem ipsum dolor <em>sit amet</em>, consectetur adipiscing elit. </strong>

Which is expected.

However, when I use default mark along with my custom one (let’s say highlights text in red color), my mark is being segregated into multiple adjacent ones:

<red>Lorem ipsum dolor</red><em><red>sit amet</red></em><red>, consectetur adipiscing elit. </red>

Is there a way to enforce an hierarchy and make the mark coexistence as follows:

<red>Lorem ipsum dolor<em>sit amet</em> consectetur adipiscing elit. </red>

Where my custom mark wraps or is being wrapped by another applied mark, instead of being cut into multiple marks?

Mark wrapping hierarchy is defined by the order in which your schema defines the marks. There is nothing special happening for the marks from the default schema.

2 Likes

Omg… Thank you so much, that did work!