Python-Markdown wrongly recognizes following as H1 and H2 headings, respectively:
Some text
=-=-=-=-=
Some text
-=-=-=-=-
This is because the regex for detection of Setext-style headings handles runs of the = and - characters incorrectly. Below the improved version, which uses (?:[=]+|[-]+) group instead of [=-]+:
RE = re.compile(r'^.*?\n(?:[=]+|[-]+)[ ]*(\n|$)', re.MULTILINE)
Python-Markdown wrongly recognizes following as H1 and H2 headings, respectively:
This is because the regex for detection of Setext-style headings handles runs of the
=and-characters incorrectly. Below the improved version, which uses(?:[=]+|[-]+)group instead of[=-]+: