Hi There !
I want to adjust the Markdown syntax so that it recognize completed “TODO” items. I consider the following as such:
- this is normal list item
+ this is completed (should be grey)
- [x] this one is also comleted
Here is the syntax I came up with after consulting with chatgpt and syntax docs 
name: MarkdownWithTodo
scope: text.html.markdown.withTodo
version: 2
hidden: false
extends: Packages/Markdown/Markdown.sublime-syntax
contexts:
main:
- match: ''
set: markdown
list-block-common:
- meta_prepend: true
- include: todo-list-items
todo-list-items:
# Case 1: + bullet, optional [x]/[X] checked checkbox
- match: '([ \t]*)([+])((?:[ ](\[)([ xX])(\]))?)\s'
captures:
1: markup.list.unnumbered.markdown
2: markup.list.unnumbered.bullet.plus.markdown punctuation.definition.list_item.markdown
3: markup.list.unnumbered.markdown
4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm
5: markup.checkbox.mark.checked.markdown-gfm
6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm
push: todo-list-item-body
# Case 2: Any bullet with checked checkbox (e.g. - [x])
- match: '([ \t]*)([*-])([ ](\[)([xX])(\]))\s'
captures:
1: markup.list.unnumbered.markdown
2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown
3: markup.list.unnumbered.markdown
4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm
5: markup.checkbox.mark.checked.markdown-gfm
6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm
push: todo-list-item-body
todo-list-item-body:
- meta_content_scope: markup.list.todo-item.body.complete
- include: todo-list-item-end
todo-list-item-end:
- match: '$'
pop: true
And it works (the color scheme for markup.list.todo-item.body.complete is also present, just assume it works). But the problem is that it does not capture the first item in each list. The first item somehow falls back to list-pagagraph for some reason. Also it does not capture the list which starts without indentation (which is not super critical but I don’t understand the reason). Here is an example:
Would appreciate any hint. I just not understand. In the “Not captured as well” it enters the unordered-list and then goes to the list-paragraph although the list-block-common rule is above.
P.S. Version: 4169
KR, Alex
