It’s fine for the first item, however if I hit “enter” within the list, instead of having a new item as expected I’m getting paragraphs within my first (and unique) list item.
The way “enter” is managed comes from commands.baseKeymap by the way. Maybe there needs to be a keymap aware of lists within the prosemirror-schema-list package?
The splitListItem command in the prosemirror-schema-list package is what you want. You could bind Enter to that in a separate keymap, which has a higher priority (comes earlier in the list of plugins) than the one built from baseKeymap.
I notice something else: wrapInList is creating a ul -> li -> p DOM to start with. When I think about it it’s logical, since the p was already there and I’m asking to wrap it in a list. Is there a way to get rid of this p tag?
You could create a schema where list items directly contain text, not blocks, but you’ll have to write your own version of wrapInList, since that one wraps, and you’d need something that strips the paragraph when adding a list.
This is not the case – splitListItem expects a prosemirror-schema-list style list structure.
The example-setup module sets up the proper bindings when it finds list nodes in the schema. The demos set up a schema with lists and use the example-setup module to make key bindings work.
Markdown editors may be a context in which it would be desirable for list items to contain inline text directly (instead of blocks), so that users can create lists that look like:
I somehow just noticed this behaviour. Is there a way to prevent this from happening? This actually is a pretty bad problem for our users right now
Edit: To be clear I mean the fact that list items get output with an empty line between them. This actually breaks the markdown formatting, resulting in two different lists.
I’m not sure if this still fits the original question of the thread, but it sounds like you’re talking about markdown serialization. In that case you could set the tightLists option to true when working with the MarkdownSerializerState.