Content expression with ? fails to parse


the document accepts this content expression: header? section+

  • header, section are in “section” group and accept “block+” content
  • article is in “block” and “section” group and accept “(block|section)+” content.

(where block are other block nodes, typically, paragraphs).

This is done to allow


Now the problem:


is parsed as


And it is parsed correctly when document content expression is changed to:

  • “header section+”

(using latest versions of prosemirror modules).

That’s odd. Are your parsing selectors unambiguous? You could try to figure out why findPlace in from_dom.js is wrapping the header node—it shouldn’t, if the node directly matches the current content expression.

I think they are, i’ll look in findPlace and if it’s not a problem with my setup i’ll post an example.

My bad, i’ve been giving a non 0 position for the parser context.