Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## [3.1.1] - 2025-05-16

### Changed
- Bumped `markdown` dependency to 3.8
- Refactored custom Markdown extensions to remove `md_globals`, use `register()`, and adjust processor priorities for compatibility with markdown >=3.4.0
6 changes: 2 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ django-mptt==0.17.0
# via -r requirements/base.in
django-sekizai==4.1.0
# via -r requirements/base.in
markdown==3.3.7
# via
# -c requirements/constraints.txt
# -r requirements/base.in
markdown==3.8
# via -r requirements/base.in
sorl-thumbnail==12.11.0
# via -r requirements/base.in
sqlparse==0.5.3
Expand Down
3 changes: 0 additions & 3 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
# Use Django LTS version pinned in common constraints
-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt

# markdown==3.4.0 contains refactoring which are breaking the package itself
markdown<3.4.0

# For python greater than or equal to 3.9 backports.zoneinfo causing failures
backports.zoneinfo; python_version<'3.9'
6 changes: 2 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ django-sekizai==4.1.0
# via -r requirements/base.txt
iniconfig==2.1.0
# via pytest
markdown==3.3.7
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
markdown==3.8
# via -r requirements/base.txt
packaging==25.0
# via pytest
pluggy==1.5.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def is_requirement(line):

setup(
name="openedx-django-wiki",
version="3.1.0",
version="3.1.1",
author="Benjamin Bach",
author_email="benjamin@overtag.dk",
long_description_content_type='text/markdown',
Expand Down
4 changes: 2 additions & 2 deletions wiki/core/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class AnchorTagExtension(Extension):
"""
Custom extension to register anchor tag processor with Markdown.
"""
def extendMarkdown(self, md, md_globals):
md.treeprocessors.add('AnchorTagProcessor', AnchorTagProcessor(md), '>inline')
def extendMarkdown(self, md):
md.treeprocessors.register(AnchorTagProcessor(md), 'AnchorTagProcessor', 20)
4 changes: 2 additions & 2 deletions wiki/plugins/attachments/markdown_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
class AttachmentExtension(markdown.Extension):
""" Abbreviation Extension for Python-Markdown. """

def extendMarkdown(self, md, md_globals):
def extendMarkdown(self, md):
""" Insert AbbrPreprocessor before ReferencePreprocessor. """
md.preprocessors.add('dw-attachments', AttachmentPreprocessor(md), '>html_block')
md.preprocessors.register(AttachmentPreprocessor(md), 'dw-attachments', 20)

class AttachmentPreprocessor(markdown.preprocessors.Preprocessor):
"""django-wiki attachment preprocessor - parse text for [attachment:id] references. """
Expand Down
4 changes: 2 additions & 2 deletions wiki/plugins/images/markdown_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
class ImageExtension(markdown.Extension):
""" Images plugin markdown extension for django-wiki. """

def extendMarkdown(self, md, md_globals):
def extendMarkdown(self, md):
""" Insert ImagePreprocessor before ReferencePreprocessor. """
md.preprocessors.add('dw-images', ImagePreprocessor(md), '>html_block')
md.preprocessors.register(ImagePreprocessor(md), 'dw-images', 20)

class ImagePreprocessor(markdown.preprocessors.Preprocessor):
"""django-wiki image preprocessor - parse text for [image:id align:left|right|center] references. """
Expand Down
4 changes: 2 additions & 2 deletions wiki/plugins/links/mdx/djangowikilinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def __init__(self, **kwargs):
# Override defaults with user settings
super().__init__(**kwargs)

def extendMarkdown(self, md, md_globals):
def extendMarkdown(self, md):
self.md = md

# append to end of inline patterns
WIKI_RE = r'\[(?P<linkTitle>[^\]]+?)\]\(wiki:(?P<wikiTitle>[a-zA-Z\d\./_-]*)\)'
wikiPathPattern = WikiPath(WIKI_RE, self.config, md=md)
wikiPathPattern.md = md
md.inlinePatterns.add('djangowikipath', wikiPathPattern, "<reference")
md.inlinePatterns.register(wikiPathPattern, 'djangowikipath', 170)


class WikiPath(markdown.inlinepatterns.Pattern):
Expand Down
8 changes: 4 additions & 4 deletions wiki/plugins/links/mdx/urlize.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def handleMatch(self, m):
else:
url = 'http://' + url

icon = markdown.util.etree.Element("span")
icon = xml.etree.ElementTree.Element("span")
icon.set('class', 'icon-globe')

span_text = markdown.util.etree.Element("span")
span_text = xml.etree.ElementTree.Element("span")
span_text.text = markdown.util.AtomicString(" " + text)
el = markdown.util.etree.Element("a")
el = xml.etree.ElementTree.Element("a")
el.set('href', url)
el.set('target', '_blank')
el.extend([icon, span_text])
Expand All @@ -92,7 +92,7 @@ def handleMatch(self, m):
class UrlizeExtension(markdown.Extension):
""" Urlize Extension for Python-Markdown. """

def extendMarkdown(self, md, md_globals):
def extendMarkdown(self, md):
""" Replace autolink with UrlizePattern """
md.inlinePatterns['autolink'] = UrlizePattern(URLIZE_RE, md)

Expand Down