Repository: zulip/zulip

Issue:
Bulleted lists with `-` are broken in the backend markdown processor
The reproducer is simple:

```
You should be able to do this:
- list of things
- more things
```

@tommyip @aero31aero FYI.  This could have been caused by our recent work on numbered lists?


Discussion:
Hello @zulip/server-markdown members, this issue was labeled with the "area: markdown" label, so you may want to check it out!

<!-- areaLabelAddition -->
@zulipbot claim

Resolving patch:
diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py
--- a/zerver/lib/bugdown/__init__.py
+++ b/zerver/lib/bugdown/__init__.py
@@ -1440,17 +1440,13 @@ def __init__(self, parser: Any) -> None:
         parser.markdown.tab_length = 4
 
 class UListProcessor(sane_lists.SaneUListProcessor):
-    """ Does not accept '+' or '-' as a bullet character. """
+    """ Unordered lists, but with 2-space indent """
 
     def __init__(self, parser: Any) -> None:
         parser.markdown.tab_length = 2
         super().__init__(parser)
         parser.markdown.tab_length = 4
 
-        self.RE = re.compile('^[ ]{0,%d}[*][ ]+(.*)' % (self.tab_length - 1,))
-        self.CHILD_RE = re.compile(r'^[ ]{0,%d}(([*]))[ ]+(.*)' %
-                                   (self.tab_length - 1,))
-
 class ListIndentProcessor(markdown.blockprocessors.ListIndentProcessor):
     """ Process unordered list blocks.
 
@@ -1502,7 +1498,7 @@ class BugdownListPreprocessor(markdown.preprocessors.Preprocessor):
         directly after a line of text, and inserts a newline between
         to satisfy Markdown"""
 
-    LI_RE = re.compile(r'^[ ]{0,3}(\*|\d\.)[ ]+(.*)', re.MULTILINE)
+    LI_RE = re.compile(r'^[ ]{0,3}([*+-]|\d\.)[ ]+(.*)', re.MULTILINE)
 
     def run(self, lines: List[str]) -> List[str]:
         """ Insert a newline between a paragraph and ulist if missing """


Test patch:
diff --git a/zerver/tests/fixtures/markdown_test_cases.json b/zerver/tests/fixtures/markdown_test_cases.json
--- a/zerver/tests/fixtures/markdown_test_cases.json
+++ b/zerver/tests/fixtures/markdown_test_cases.json
@@ -156,11 +156,30 @@
       "expected_output": "<p>Hello [world][ref-name]</p>\n<p>[ref-name]: <a href=\"https://google.com\" target=\"_blank\" title=\"https://google.com\">https://google.com</a></p>"
     },
     {
-      "name": "ulist_standard",
+      "name": "ulist_standard_1",
       "input": "Some text with a list:\n\n* One item\n* Two items\n* Three items",
       "expected_output": "<p>Some text with a list:</p>\n<ul>\n<li>One item</li>\n<li>Two items</li>\n<li>Three items</li>\n</ul>",
       "text_content": "Some text with a list:\n\nOne item\nTwo items\nThree items\n"
     },
+    {
+      "name": "ulist_standard_2",
+      "input": "Some text with a list:\n\n- One item\n- Two items\n- Three items",
+      "expected_output": "<p>Some text with a list:</p>\n<ul>\n<li>One item</li>\n<li>Two items</li>\n<li>Three items</li>\n</ul>",
+      "text_content": "Some text with a list:\n\nOne item\nTwo items\nThree items\n"
+    },
+    {
+      "name": "ulist_standard_3",
+      "input": "Some text with a list:\n\n+ One item\n+ Two items\n+ Three items",
+      "expected_output": "<p>Some text with a list:</p>\n<ul>\n<li>One item</li>\n<li>Two items</li>\n<li>Three items</li>\n</ul>",
+      "text_content": "Some text with a list:\n\nOne item\nTwo items\nThree items\n"
+    },
+    {
+      "name": "ulist_mixed_bullets",
+      "input": "Combine four lists:\n\n* One\n- Two\n+ Three\n- Four\n- Five",
+      "expected_output": "<p>Combine four lists:</p>\n<ul>\n<li>One</li>\n<li>Two</li>\n<li>Three</li>\n<li>Four</li>\n<li>Five</li>\n</ul>",
+      "marked_expected_output": "<p>Combine four lists:</p>\n<ul>\n<li>One</li>\n</ul>\n<ul>\n<li>Two</li>\n</ul>\n<ul>\n<li>Three</li>\n</ul>\n<ul>\n<li>Four</li>\n<li>Five</li>\n</ul>",
+      "text_content": "Combine four lists:\n\nOne\nTwo\nThree\nFour\nFive\n"
+    },
     {
       "name": "ulist_hanging",
       "input": "Some text with a hanging list:\n* One item\n* Two items\n* Three items",