e6dcb64ab4ee — Oben Sonne 8 years ago
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.
1 files changed, 2 insertions(+), 0 deletions(-)

M src/markowik/mdx.py
M src/markowik/mdx.py +2 -0
@@ 6,6 6,7 @@ import re
 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 @@ class MarkowikExtension(markdown.Extensi
         pp = MarkowikPreprocessor()
         tp = MarkowikTreeprocessor(self)
         md.preprocessors.add('markowik', pp, '_end')
+        md.inlinePatterns['escape'] = SimpleTextPattern(ESCAPE_RE)
         md.treeprocessors.add('markowik', tp, '_end')
 
 # =============================================================================