Skip to content

Commit

Permalink
Fix deprecation warnings with Python-Markdown 3.x
Browse files Browse the repository at this point in the history
Fixes #21.
  • Loading branch information
mitya57 committed Nov 3, 2018
1 parent cfd83b0 commit 7c2a823
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mdx_math.py
Expand Up @@ -31,7 +31,7 @@ def _get_content_type(self):
return 'math/asciimath'
return 'math/tex'

def extendMarkdown(self, md, md_globals):
def extendMarkdown(self, md):
def _wrap_node(node, preview_text, wrapper_tag):
if not self.getConfig('add_preview'):
return node
Expand Down Expand Up @@ -72,10 +72,11 @@ def handle_match(m):
mathpatterns = mathpatterns[:-1] # \begin...\end is TeX only
for i, pattern in enumerate(mathpatterns):
pattern.handleMatch = handle_match
md.inlinePatterns.add('math-%d' % i, pattern, '<escape')
# we should have higher priority than 'escape' which has 180
md.inlinePatterns.register(pattern, 'math-%d' % i, 185)
for i, pattern in enumerate(inlinemathpatterns):
pattern.handleMatch = handle_match_inline
md.inlinePatterns.add('math-inline-%d' % i, pattern, '<escape')
md.inlinePatterns.register(pattern, 'math-inline-%d' % i, 185)
if self.getConfig('enable_dollar_delimiter'):
md.ESCAPED_CHARS.append('$')

Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -14,6 +14,7 @@
version='0.6',
url='https://github.com/mitya57/python-markdown-math',
py_modules=['mdx_math'],
install_requires=['Markdown>=3.0'],
entry_points={
'markdown.extensions': [
'mdx_math = mdx_math:MathExtension',
Expand Down

0 comments on commit 7c2a823

Please sign in to comment.