How to Parse Nested Mark Attributes?

Lets say i have a schema with a basic text-color mark. Lets say i have an HTML string like so, with some nested style attributes:

<span style="color: red">
  i am red
  <span style="color: blue">i am blue</span>
  i am also red
</span>

I’d like to parse this into a document, and i’d expect for the marks to roughly match what

(mark color="red" i am red)
(mark color="blue" i am blue)
(mark color="red" i am also red)

The document actually looks more like this:

(mark color="red" i am red)
(mark color="blue" i am blue)
i am also red

How can i alter the input or output to get the result i’d expect?


Demo REPL: DangerousStridentQuadrant - Replit

That behavior was a bug. This patch cleans up some misguided code in the DOM parser and adds a test case for this situation.

Wow. prosemirror-model@1.22.3 indeed yields the marks I’m looking for. Thank you so much!