Content expression with ? fails to parse


#1

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).


#2

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.


#3

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


#4

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