Nested marks converted incorrectly to HTML

That’s not something the library supports. You can determine nesting order (by changing the order in which you provide the marks when defining the schema), but there’s a fixed order.