# HG changeset patch # User Oben Sonne # Date 1327350433 -3600 # Mon Jan 23 21:27:13 2012 +0100 # Node ID e6dcb64ab4eefd69ab8ebc256c24fb330a1b5d4f # Parent 5bb360da39b21331cd628d6539e546d8b8398cd6 markdown: do not use placeholders for escaped characters This patch recreates the Python Markdown 2.0.3 behavior where escaped characters are simply unescaped. Python Markdown 2.1 replaces them with placeholders which makes it impossible to decide if it is some inline HTML, some escaped character or anything else. Additionally it is not possible to apply special treatment to the escaped characters because they are hidden. diff --git a/src/markowik/mdx.py b/src/markowik/mdx.py --- a/src/markowik/mdx.py +++ b/src/markowik/mdx.py @@ -6,6 +6,7 @@ import textwrap import markdown.treeprocessors +from markdown.inlinepatterns import ESCAPE_RE, SimpleTextPattern from markdown.util import etree, STX from markowik.util import dump, log, truncate, escapewikiwords @@ -426,6 +427,7 @@ pp = MarkowikPreprocessor() tp = MarkowikTreeprocessor(self) md.preprocessors.add('markowik', pp, '_end') + md.inlinePatterns['escape'] = SimpleTextPattern(ESCAPE_RE) md.treeprocessors.add('markowik', tp, '_end') # =============================================================================