diff --git a/lib/markdown2.py b/lib/markdown2.py index 817c6eb2..d63653b7 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -2056,8 +2056,13 @@ def _form_paragraphs(self, text): # text (issue 33). Note the `[-1]` is a quick way to # consider numeric bullets (e.g. "1." and "2.") to be # equal. - if (li and len(li.group(2)) <= 3 and li.group("next_marker") - and li.group("marker")[-1] == li.group("next_marker")[-1]): + if (li and len(li.group(2)) <= 3 + and ( + (li.group("next_marker") and li.group("marker")[-1] == li.group("next_marker")[-1]) + or + li.group("next_marker") is None + ) + ): start = li.start() cuddled_list = self._do_lists(graf[start:]).rstrip("\n") assert cuddled_list.startswith("
Here is an asterisk, -* What do you think + * What do you think about it?
I suggest using version -8. Oops, now this line is treated + 8. Oops, now this line is treated as a sub-list.
diff --git a/test/tm-cases/cuddled_para_and_list.text b/test/tm-cases/cuddled_para_and_list.text index 198d2b7b..fac5c09f 100644 --- a/test/tm-cases/cuddled_para_and_list.text +++ b/test/tm-cases/cuddled_para_and_list.text @@ -15,10 +15,10 @@ And these in order: 3. bullet3 Here is an asterisk, -* What do you think + * What do you think about it? I suggest using version -8. Oops, now this line is treated + 8. Oops, now this line is treated as a sub-list.