Skip to content

Commit

Permalink
Merge pull request #328 from thealphadollar/patch-1
Browse files Browse the repository at this point in the history
Accept [X] as marked task
  • Loading branch information
nicholasserra committed May 28, 2019
2 parents fca47a1 + af70b30 commit f3259c6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/markdown2.py
Expand Up @@ -1655,7 +1655,7 @@ def _do_lists(self, text):
re.M | re.X | re.S)

_task_list_item_re = re.compile(r'''
(\[[\ x]\])[ \t]+ # tasklist marker = \1
(\[[\ xX]\])[ \t]+ # tasklist marker = \1
(.*) # list item text = \2
''', re.M | re.X | re.S)

Expand All @@ -1664,7 +1664,7 @@ def _do_lists(self, text):
def _task_list_item_sub(self, match):
marker = match.group(1)
item_text = match.group(2)
if marker == '[x]':
if marker in ['[x]','[X]']:
return self._task_list_warpper_str % ('checked ', item_text)
elif marker == '[ ]':
return self._task_list_warpper_str % ('', item_text)
Expand Down
1 change: 1 addition & 0 deletions test/tm-cases/task_list.html
@@ -1,4 +1,5 @@
<ul>
<li><input type="checkbox" class="task-list-item-checkbox" checked disabled> item1</li>
<li><input type="checkbox" class="task-list-item-checkbox" disabled> item2</li>
<li><input type="checkbox" class="task-list-item-checkbox" checked disabled> item3</li>
</ul>
1 change: 1 addition & 0 deletions test/tm-cases/task_list.text
@@ -1,2 +1,3 @@
- [x] item1
- [ ] item2
- [X] item3

0 comments on commit f3259c6

Please sign in to comment.