summaryrefslogtreecommitdiff
path: root/markdown/treeprocessors.py
diff options
context:
space:
mode:
Diffstat (limited to 'markdown/treeprocessors.py')
-rw-r--r--markdown/treeprocessors.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index d2036f6..c07acdc 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -48,7 +48,7 @@ class InlineProcessor(Treeprocessor):
def __init__(self, md):
super(InlineProcessor, self).__init__(md)
- self.TOKEN_RE = re.compile(r'|'.join('\\{0}'.format(x) for x in md.ESCAPED_CHARS))
+ self.TOKEN_RE = re.compile(r'|'.join('\\{0}'.format(x) for x in md.ESCAPED_CHARS + [' \n']))
def apply_patterns(self, text):
"""
@@ -61,10 +61,11 @@ class InlineProcessor(Treeprocessor):
match = pattern.getCompiledRegExp().match(text)
if match:
node = pattern.handleMatch(match)
- text = text[match.end():]
+ if node is not None:
+ text = text[match.end():]
break
- if not match:
+ if not match or node is None:
# Step forward one character
return text[0], None, text[1:]