ProseMirror / prosemirror-markdown

ProseMirror Markdown integration
https://prosemirror.net
MIT License
344 stars 81 forks source link

Task list support #42

Open iamcarbon opened 4 years ago

iamcarbon commented 4 years ago

It would be useful to support the task list extension in the library (used by GitHUB and others). Happy to sponsor the time on the work if this is a feature the library would accept.

Here's the specification.

https://docs.github.com/en/github/managing-your-work-on-github/about-task-lists

- [x] Finish my changes
- [ ] Push my commits to GitHub
- [ ] Open a pull request
ocavue commented 4 years ago

You can check my implementation here: https://github.com/ocavue/rino/blob/5136c00f17365ebd8d8f43c45a627780401b1476/packages/web/src/editor/extensions/list/list-extension.ts#L199

it's written in typescript and remirror so the code can't be copy directly into Prosemirror-Mardkown, but you should get the idea easily.

neaumusic commented 3 months ago
    taskList(state, node, parent, index) {
      state.renderList(node, '  ', i => (node.child(i).attrs.checked ? '- [x] ' : '- [ ] '))
    },

this may be all thats needed, haven't tested it thoroughly, but taskList is the node name from my doc.type.schema