1. Oben Sonne
  2. markowik

Commits

Oben Sonne  committed e6dcb64

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.

  • Participants
  • Parent commits 5bb360d
  • Branches default

Comments (0)

Files changed (1)

File src/markowik/mdx.py

View file
  • Ignore whitespace
 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
         pp = MarkowikPreprocessor()
         tp = MarkowikTreeprocessor(self)
         md.preprocessors.add('markowik', pp, '_end')
+        md.inlinePatterns['escape'] = SimpleTextPattern(ESCAPE_RE)
         md.treeprocessors.add('markowik', tp, '_end')
 
 # =============================================================================