How to configure (nesting) order of marks?

Guide does mention following:

The order in which marks appear is specified by the schema.

But then I can’t find anywhere in the guide or docs how that order can be specified ?

2 Likes

It seems that order in which they appear in schema definition specifies the order in which they will nest as well.

1 Like

Exactly. The OrderedMap type is written so that even when messing with a set of marks after the fact, you can still control their order.

3 Likes

Just discovered this! The level of thought that went into building prosemirror is unbelievable!

1 Like

I just got here as well while trying to understand where the mark rank was coming from in the schema and I’m wondering if there’s any way of making the nesting order based on the order which the user applies the marks instead.

Basically I have different types of highlighting that can overlap. Considering the extensions are declared as HighlightOne, HighlightTwo in the schema, that works fine if the second style is overlapping with the first:

<span data-type="highlight-1">Some text with some <span data-type="highlight-2">overlapping information</span></span>

But adds an extra span if it’s the other way around:

<span data-type="highlight-2">Some text with some <span data-type="highlight-1"><span data-type="highlight-2">overlapping information</span></span></span>

Any suggestions?

It’s defined by the order in which the marks appear in the schema definition.

No.