-
-
Notifications
You must be signed in to change notification settings - Fork 279
Infinite loop with custom list_item_pattern #331
Copy link
Copy link
Closed
Description
Mistune 2.x here.
I'm trying to add the character • (bullet, unicode u2022) as a list item marker :
mistune.BlockParser.LIST_START = re.compile('( {0,3})([\\*\\+\\u2022\\-]|\\d{1,9}[.)])(?:[ \\t]*|[ \\t][^\\n]+)\\n+')
This ends with an infinite loop in the methode _create_list_item_pattern, since it doesn't match any of the default markdown markers :
# mistune/block_parser.py:320
if marker == '*':
prefix = prefix + r'\*'
elif marker == '+':
prefix = prefix + r'\+'
else:
prefix = prefix + r'-'I finally made it work with the following else case :
# mistune/block_parser.py:320
if marker == '*':
prefix = prefix + r'\*'
elif marker == '+':
prefix = prefix + r'\+'
else:
prefix = prefix + rf'{marker}'Is there any risk to use a variable into the generated regex ? Is there any chance this change to be included in Mistune 2.x ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels