Skip to content

refactor: update markdown to 3.8 and adapt extension code for compatibility #303

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

Merged

Conversation

wgu-ram-chandra
Copy link

@wgu-ram-chandra wgu-ram-chandra commented May 16, 2025

Purpose

This PR resolves a compatibility issue with the markdown dependency, which surfaced while addressing edx-platform issue #35271.

Background

The edx-platform currently pins markdown to <3.4.0. When attempting to lift that constraint and upgrade markdown to the latest version (3.8), tests in this repository failed due to breaking changes introduced in markdown>=3.4.0.

As outlined in the markdown 3.4 release notes, key breaking changes include:

  • Removal of the md_globals parameter from Extension.extendMarkdown()
  • Replacing the .add() method with .register() in processor registration
  • Changing the argument order and priority system in processor registration
  • Refactoring of markdown.util.etree to use the standard library's xml.etree.ElementTree

Below is a sample illustration of changes from the 3.4 release notes
ss

Changes Made

  • Upgraded markdown to version 3.8 in base.in and test.in

  • Refactored custom Markdown extensions to:

    • Remove deprecated md_globals usage
    • Replace add() with register() for preprocessor and treeprocessor registration
    • Use integer-based priority values instead of deprecated string-based values (e.g., '>inline', '>html_block')
  • Ensured compatibility with the updated Markdown processing API

  • Verified all tests pass after the upgrade

Follow-Up

Once this PR is merged, it will unblock and help resolve:
edx-platform issue #35271

References

Copy link
Member

@UsamaSadiq UsamaSadiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to run make upgrade using Python 3.12 env to keep the requirements consistent across all open edX repositories.
Other than that the changes look good to merge.

@wgu-ram-chandra wgu-ram-chandra force-pushed the fix-markdown-compatibility branch from 07b5cae to e0ab895 Compare May 16, 2025 21:54
@openedx-webhooks
Copy link

Thanks for the pull request, @wgu-ram-chandra!

This repository is currently maintained by @2U-aperture.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@wgu-ram-chandra
Copy link
Author

Hi @UsamaSadiq, earlier when I ran make upgrade, it also upgraded some other dependencies like tox and pluggy, which I wasn’t expecting. I had started cleaning that up but stepped away from my computer. I've now re-run make upgrade correctly and pushed the updated changes. Let me know if there's anything else you'd like me to adjust!

@wgu-ram-chandra wgu-ram-chandra added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label May 16, 2025
Copy link
Member

@UsamaSadiq UsamaSadiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge.

@wgu-ram-chandra
Copy link
Author

Thanks @UsamaSadiq! Could you please merge this PR when you get a chance? I don’t have the necessary permissions to do so.

@UsamaSadiq
Copy link
Member

Sure. You may also need to bump the package version if you need this package updated in edx-platform.
Update package CHANGE LOG and bump version in __init__.py file and I'll go ahead and merge it.

@wgu-ram-chandra wgu-ram-chandra force-pushed the fix-markdown-compatibility branch from e0ab895 to a325702 Compare May 17, 2025 04:44
@wgu-ram-chandra
Copy link
Author

Hi @UsamaSadiq, I’ve made the changes you requested, including bumping the version in setup.py and adding a changelog for the release. Please have a look and let me know if everything looks good or if any further updates are needed.

@UsamaSadiq UsamaSadiq merged commit 964679f into openedx:edx_release May 17, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in Contributions May 17, 2025
@UsamaSadiq
Copy link
Member

package version https://pypi.org/project/openedx-django-wiki/3.1.1/ has been released with this change on PyPI

@wgu-ram-chandra
Copy link
Author

Thank you @UsamaSadiq!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants