added tasklist extra and unit test by liguangsheng · Pull Request #218 · trentm/python-markdown2

@liguangsheng

added tasklist extra and unit test.

See Issue #216

@liguangsheng

@liguangsheng

@nicholasserra

This was referenced

Jun 24, 2016

cosven

(.*) # list item text = \2
''', re.M | re.X | re.S)

_task_list_warpper_str = r'<p><input type="checkbox" class="task-list-item-checkbox" %sdisabled>%s</p>'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, the <p> tag is unnecessary.
We can also have a look at github flavour markdown parser result

<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" checked="" disabled=""> text body </li>

thealphadollar

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look into this.

def _task_list_item_sub(self, match):
marker = match.group(1)
item_text = match.group(2)
if marker == '[x]':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should also take into account the situation where an uppercase X is used since Github markdown also accepts that.

For e.g.

  • this is marked
  • this is also marked