diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..52239b905 --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/requirements/base.txt b/requirements/base.txt index 31e20bf90..f34e5db75 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -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 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 982a6ca6e..3fefe22c8 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -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' diff --git a/requirements/test.txt b/requirements/test.txt index 4c87211d2..c80dc1b17 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -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 diff --git a/setup.py b/setup.py index 4e066a679..85cb07868 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/wiki/core/extensions.py b/wiki/core/extensions.py index 5d19e893c..9a1e150c6 100644 --- a/wiki/core/extensions.py +++ b/wiki/core/extensions.py @@ -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) diff --git a/wiki/plugins/attachments/markdown_extensions.py b/wiki/plugins/attachments/markdown_extensions.py index 9275af3a1..0af9c6982 100644 --- a/wiki/plugins/attachments/markdown_extensions.py +++ b/wiki/plugins/attachments/markdown_extensions.py @@ -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. """ diff --git a/wiki/plugins/images/markdown_extensions.py b/wiki/plugins/images/markdown_extensions.py index 8cca18c18..389fae123 100644 --- a/wiki/plugins/images/markdown_extensions.py +++ b/wiki/plugins/images/markdown_extensions.py @@ -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. """ diff --git a/wiki/plugins/links/mdx/djangowikilinks.py b/wiki/plugins/links/mdx/djangowikilinks.py index 77e8a9d9a..0d386ef05 100755 --- a/wiki/plugins/links/mdx/djangowikilinks.py +++ b/wiki/plugins/links/mdx/djangowikilinks.py @@ -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[^\]]+?)\]\(wiki:(?P[a-zA-Z\d\./_-]*)\)' wikiPathPattern = WikiPath(WIKI_RE, self.config, md=md) wikiPathPattern.md = md - md.inlinePatterns.add('djangowikipath', wikiPathPattern, "