Content expression with ? fails to parse

Hi,

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

<article>
    <header>...
    <article><header></header><section></section></article>
    <article><header></header><section></section></article>

Now the problem:

<header><p>title</p></header>
<section><p>body</p></section>

is parsed as

<section><article><header><p>title</p></section></header></article></section>
<section><p>body</p></section>

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.