Adding support in markdown (GFM) to continue TaskList markup

Hi, I’m using the GFM configuration for @codemirror/markdown-lang and noticed that while lists (both ordered and unordered) will automatically continue thanks to the insertNewlineContinueMarkup() function, this function unfortunately does not support auto-continuing TaskLists.

As I could not see any way to “extend” this function I just started to rewrite it. Unfortunately I’m having a little trouble parsing exactly what everything is doing in those functions. Specifically I’m not entirely sure I understand the necessity of the interactions between the insertNewlineContinueMarkup() function and the getContext() function.

Part of the problem I think is that while the structure of the other lists is:

BulletList > ListItem

The structure of a TaskList is actually:

BulletList > ListItem > Task

And most of the code is structure around that two-layer assumption rather than three. So at this point I’m unsure if the solution is to change the parser to no longer consider the Task just some level below a “normal” list and have it be something like:

TaskList > Task (or potentially this could also just be a ListItem?)

or if I should instead just figure out how to make the markdown functions play nicely with the fact that Task’s are actually just below a normal list.

Any guidance / thoughts?

One possible direction would be to add node props to your syntax nodes that signal how the commands should behave, and write those commands without hard-coding node types. If that turns out to work very well, I’d be interested in seeing if it’d be appropriate for the lang-markdown implementation as well.