Skip to content

Conversation

facelessuser
Copy link
Collaborator

Bold/italic nesting fix and toc recursion fix. See commits for more info.

The logic for the current regex for strong/em and em/strong was sound,
but the way it was implemented caused some unintended side effects.
Whether it is a quirk with regex in general or just with Python’s re
engine, I am not sure.  Put basically `(\*|_){3}`  causes issues with
nested bold/italic. So, allowing the group to be defined, and then
using the group number to specify the remaining sequential chars is a
better way that works more reliably `(\*|_)\2{2}.  Test from issue #365
was also added to check for this case in the future.
This reworks the toc ordering to be done in a single pass with no
recursion.  Very long documents with lots of headers can actually
exceed Python’s max recursion limit.  By handling the toc ordering with
no recursion, large documents can no longer cause toc to fail with
recursion erros.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) when pulling 69fd8b4 on facelessuser:master into f0357b2 on waylan:master.

waylan added a commit that referenced this pull request Nov 18, 2014
@waylan waylan merged commit ed0ff55 into Python-Markdown:master Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants