How to make A block node contain arbitrary inline children or block children (NOT mixing block and inline node)

According to the HTML specification, a block element can contain either block elements or inline elements. Although ProseMirror does not support mixing of the two. But, is there a way to make a node that allows to include only inline nodes as well as block nodes (The two do NOT mix with each other) ?



Both of them should be valid.

I’ve tried to define a node schema’s content as (inline* | block*),. However, it thrown an error: SyntaxError: Mixing inline and block content.

No, you’ll have to define two different parent node types to do something like that.

Thanks for your kind reply. I think defining two different nodes is not a better workaround. In particular, you need to treat two different nodes as one type.

Now, I can only define a block node, filter it when exporting html, and remove the embedded p-tag (if there is only one p-tag).

Additionally, is it feasible to support such logic from the bottom? After all, this is in line with the needs of the real world.