From c871eb057d7c160ac8b2ce9ae4a9c90bb159573a Mon Sep 17 00:00:00 2001 From: Kyle King Date: Sat, 18 Oct 2025 20:44:31 -0600 Subject: [PATCH 1/3] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20UPGRADE:=20Support=20m?= =?UTF-8?q?dformat=20v1=20and=20Python=20>=3D3.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 10 +++++----- mdformat_myst/plugin.py | 22 +++++++++++----------- pyproject.toml | 10 +++++----- tox.ini | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5dab43e..1e26d8d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,14 +17,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.11 + python-version: '3.10' - uses: pre-commit/action@v3.0.0 tests: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.9', '3.13', '3.14-dev'] + python-version: ['3.10', '3.13', '3.14-dev'] os: [ubuntu-latest, macos-latest, windows-latest] continue-on-error: ${{ matrix.python-version == '3.14-dev' }} @@ -49,7 +49,7 @@ jobs: # FYI: Requires token to continue usage # - name: Upload to Codecov - # if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 + # if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.10 # uses: codecov/codecov-action@v1 # with: # name: pytests @@ -65,7 +65,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: '3.10' - name: Installation (deps and package) run: | @@ -87,7 +87,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: '3.10' - name: install flit run: | pip install flit~=3.0 diff --git a/mdformat_myst/plugin.py b/mdformat_myst/plugin.py index 077ce15..007b1ef 100644 --- a/mdformat_myst/plugin.py +++ b/mdformat_myst/plugin.py @@ -23,17 +23,17 @@ def update_mdit(mdit: MarkdownIt) -> None: mdit.options["parser_extension"].append(tables_plugin) tables_plugin.update_mdit(mdit) - # Enable mdformat-frontmatter plugin - frontmatter_plugin = mdformat.plugins.PARSER_EXTENSIONS["frontmatter"] - if frontmatter_plugin not in mdit.options["parser_extension"]: - mdit.options["parser_extension"].append(frontmatter_plugin) - frontmatter_plugin.update_mdit(mdit) - - # Enable mdformat-footnote plugin - footnote_plugin = mdformat.plugins.PARSER_EXTENSIONS["footnote"] - if footnote_plugin not in mdit.options["parser_extension"]: - mdit.options["parser_extension"].append(footnote_plugin) - footnote_plugin.update_mdit(mdit) + # # Enable mdformat-frontmatter plugin + # frontmatter_plugin = mdformat.plugins.PARSER_EXTENSIONS["frontmatter"] + # if frontmatter_plugin not in mdit.options["parser_extension"]: + # mdit.options["parser_extension"].append(frontmatter_plugin) + # frontmatter_plugin.update_mdit(mdit) + # + # # Enable mdformat-footnote plugin + # footnote_plugin = mdformat.plugins.PARSER_EXTENSIONS["footnote"] + # if footnote_plugin not in mdit.options["parser_extension"]: + # mdit.options["parser_extension"].append(footnote_plugin) + # footnote_plugin.update_mdit(mdit) # Enable MyST role markdown-it extension mdit.use(myst_role_plugin) diff --git a/pyproject.toml b/pyproject.toml index 4260c7f..cd65ae2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,13 +18,13 @@ classifiers = [ ] keywords = "mdformat,markdown,formatter,gfm" -requires-python=">=3.9" +requires-python=">=3.10" requires=[ - "mdformat >=0.7.0", + "mdformat >=1.0.0", "mdit-py-plugins >=0.3.0", - "mdformat-tables >=0.4.0", - "mdformat-frontmatter >=0.3.2", - "mdformat-footnote >=0.1.1", + # "mdformat-footnote >=0.1.2", # FIXME: blocked by https://github.com/executablebooks/mdformat-footnote/issues/12#issuecomment-3419147670 + # "mdformat-frontmatter >=0.3.2", # FIXME: blocked by https://github.com/butler54/mdformat-frontmatter/issues/37 + "mdformat-gfm >=1.0.0", "ruamel.yaml >=0.16.0", ] diff --git a/tox.ini b/tox.ini index 3f8959b..05aad8c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,15 @@ [tox] -envlist = py39 +envlist = py310 isolated_build = True -[testenv:py{39,311,313}] +[testenv:py{310,313}] extras = test deps = black flake8 commands = pytest {posargs} -[testenv:py{39,311,313}-hook] +[testenv:py{310,313}-hook] commands = pre-commit run --config .pre-commit-test.yaml {posargs:--all-files --verbose --show-diff-on-failure} [flake8] From 6dc5d7234f2c5adb4c9f31ea3e2b3457eb8b7220 Mon Sep 17 00:00:00 2001 From: Kyle King Date: Sat, 18 Oct 2025 21:06:14 -0600 Subject: [PATCH 2/3] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20UPGRADE:=20Migrate=20m?= =?UTF-8?q?dformat-tables=20to=20-gfm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 10 +++++----- mdformat_myst/plugin.py | 22 +++++++++++----------- pyproject.toml | 10 +++++----- tox.ini | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1e26d8d..5dab43e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,14 +17,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: 3.11 - uses: pre-commit/action@v3.0.0 tests: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.13', '3.14-dev'] + python-version: ['3.9', '3.13', '3.14-dev'] os: [ubuntu-latest, macos-latest, windows-latest] continue-on-error: ${{ matrix.python-version == '3.14-dev' }} @@ -49,7 +49,7 @@ jobs: # FYI: Requires token to continue usage # - name: Upload to Codecov - # if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.10 + # if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 # uses: codecov/codecov-action@v1 # with: # name: pytests @@ -65,7 +65,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.10' + python-version: 3.9 - name: Installation (deps and package) run: | @@ -87,7 +87,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: 3.9 - name: install flit run: | pip install flit~=3.0 diff --git a/mdformat_myst/plugin.py b/mdformat_myst/plugin.py index 007b1ef..077ce15 100644 --- a/mdformat_myst/plugin.py +++ b/mdformat_myst/plugin.py @@ -23,17 +23,17 @@ def update_mdit(mdit: MarkdownIt) -> None: mdit.options["parser_extension"].append(tables_plugin) tables_plugin.update_mdit(mdit) - # # Enable mdformat-frontmatter plugin - # frontmatter_plugin = mdformat.plugins.PARSER_EXTENSIONS["frontmatter"] - # if frontmatter_plugin not in mdit.options["parser_extension"]: - # mdit.options["parser_extension"].append(frontmatter_plugin) - # frontmatter_plugin.update_mdit(mdit) - # - # # Enable mdformat-footnote plugin - # footnote_plugin = mdformat.plugins.PARSER_EXTENSIONS["footnote"] - # if footnote_plugin not in mdit.options["parser_extension"]: - # mdit.options["parser_extension"].append(footnote_plugin) - # footnote_plugin.update_mdit(mdit) + # Enable mdformat-frontmatter plugin + frontmatter_plugin = mdformat.plugins.PARSER_EXTENSIONS["frontmatter"] + if frontmatter_plugin not in mdit.options["parser_extension"]: + mdit.options["parser_extension"].append(frontmatter_plugin) + frontmatter_plugin.update_mdit(mdit) + + # Enable mdformat-footnote plugin + footnote_plugin = mdformat.plugins.PARSER_EXTENSIONS["footnote"] + if footnote_plugin not in mdit.options["parser_extension"]: + mdit.options["parser_extension"].append(footnote_plugin) + footnote_plugin.update_mdit(mdit) # Enable MyST role markdown-it extension mdit.use(myst_role_plugin) diff --git a/pyproject.toml b/pyproject.toml index cd65ae2..92c2021 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,13 +18,13 @@ classifiers = [ ] keywords = "mdformat,markdown,formatter,gfm" -requires-python=">=3.10" +requires-python=">=3.9" requires=[ - "mdformat >=1.0.0", + "mdformat >=0.7.0", "mdit-py-plugins >=0.3.0", - # "mdformat-footnote >=0.1.2", # FIXME: blocked by https://github.com/executablebooks/mdformat-footnote/issues/12#issuecomment-3419147670 - # "mdformat-frontmatter >=0.3.2", # FIXME: blocked by https://github.com/butler54/mdformat-frontmatter/issues/37 - "mdformat-gfm >=1.0.0", + "mdformat-frontmatter >=0.3.2", + "mdformat-footnote >=0.1.1", + "mdformat-gfm >=0.4.0", "ruamel.yaml >=0.16.0", ] diff --git a/tox.ini b/tox.ini index 05aad8c..3f8959b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,15 @@ [tox] -envlist = py310 +envlist = py39 isolated_build = True -[testenv:py{310,313}] +[testenv:py{39,311,313}] extras = test deps = black flake8 commands = pytest {posargs} -[testenv:py{310,313}-hook] +[testenv:py{39,311,313}-hook] commands = pre-commit run --config .pre-commit-test.yaml {posargs:--all-files --verbose --show-diff-on-failure} [flake8] From 6fbb8775275ae7251f65879cc5b577380bfbee53 Mon Sep 17 00:00:00 2001 From: Kyle King Date: Sun, 19 Oct 2025 09:18:58 -0600 Subject: [PATCH 3/3] fix: support Python 3.9 with mdformat-tables --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 92c2021..605f2b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,17 +22,17 @@ requires-python=">=3.9" requires=[ "mdformat >=0.7.0", "mdit-py-plugins >=0.3.0", + "mdformat-tables >=0.4.0; python_version < '3.10'", "mdformat-frontmatter >=0.3.2", "mdformat-footnote >=0.1.1", - "mdformat-gfm >=0.4.0", + "mdformat-gfm >=1.0.0; python_version >= '3.10'", "ruamel.yaml >=0.16.0", ] [tool.flit.metadata.requires-extra] test = [ - "pytest", - "coverage", - "pytest-cov", + "pytest>=8.0.0", + "pytest-cov>=7.0.0", ] dev = ["pre-commit"]