Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix md_inline_extension compatibility errors with Markdown >= 3.4 #1374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions md_inline_extension/pelican_inline_markdown_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import markdown
import re
import xml.etree.ElementTree as etree

from markdown.util import etree
from markdown.util import AtomicString

class PelicanInlineMarkdownExtensionPattern(markdown.inlinepatterns.Pattern):
Expand All @@ -21,7 +21,7 @@ def __init__(self, pelican_markdown_extension, tag, pattern):
self.config = pelican_markdown_extension.getConfig('config')

def handleMatch(self, m):
node = markdown.util.etree.Element(self.tag)
node = etree.Element(self.tag)
tag_attributes = self.config.get(m.group('prefix'), ('', 'pelican-inline'))
tag_class = 'pelican-inline' # default class
tag_style = '' # default is for no styling
Expand Down Expand Up @@ -54,7 +54,7 @@ def __init__(self, config):
config['config'] = [config['config'], 'config for markdown extension']
super(PelicanInlineMarkdownExtension, self).__init__(config)

def extendMarkdown(self, md, md_globals):
def extendMarkdown(self, md):
# Regex to detect mathjax
config = self.getConfig('config')
patterns = []
Expand All @@ -66,4 +66,4 @@ def extendMarkdown(self, md, md_globals):
inline_regex = r'(?P<prefix>%s)(?P<text>.+?)\2' % ('|'.join(patterns))

# Process after escapes
md.inlinePatterns.add('texthighlight_inlined', PelicanInlineMarkdownExtensionPattern(self, 'span', inline_regex), '>emphasis2')
md.inlinePatterns.register('texthighlight_inlined', PelicanInlineMarkdownExtensionPattern(self, 'span', inline_regex), 321)