From a823912e5d5b834a4f083c613662941c413ed24b Mon Sep 17 00:00:00 2001 From: facelessuser Date: Wed, 18 Jun 2025 14:35:37 -0600 Subject: [PATCH 1/9] Fixes for Python 3.14 and fixes for deprecations - Fix codecs deprecation - Fix issue with unclosed ` int: if self.rawdata[i:i+3] == ' int: if self.rawdata[i:i+3] == ' int: # pragma: no cover self.__starttag_text = None endpos = self.check_for_whole_start_tag(i) if endpos < 0: - return endpos + self.handle_data(self.rawdata[i:i + 1]) + return i + 1 rawdata = self.rawdata self.__starttag_text = rawdata[i:endpos] From 0d7a5dd01efd2eb18c9f648f29872baadf8d49d7 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Wed, 18 Jun 2025 17:05:27 -0600 Subject: [PATCH 2/9] Fix unclosed comments --- docs/changelog.md | 3 ++- markdown/htmlparser.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 8c2b156a4..d766dbcd6 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -15,7 +15,8 @@ See the [Contributing Guide](contributing.md) for details. ### Fixed * Fix `codecs` deprecation. -* Fix issue with unclosed `': + self.handle_data(''.format(data), is_block=True) + def updatepos(self, i: int, j: int) -> int: + if self.override_comment_update: + self.override_comment_update = False + i = 0 + j = 4 + return super().updatepos(i, j) + def handle_decl(self, data: str): self.handle_empty_tag(''.format(data), is_block=True) From 8a1b4123ff1e57c0a9c10e5ce666c211182a2453 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Wed, 18 Jun 2025 17:10:40 -0600 Subject: [PATCH 3/9] Fix spelling --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index d766dbcd6..0f254323f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -16,7 +16,7 @@ See the [Contributing Guide](contributing.md) for details. * Fix `codecs` deprecation. * Fix issue with unclosed comment parsing in Python 3.14. -* Fix issue with unclosed declerations in Python 3.14. +* Fix issue with unclosed declarations in Python 3.14. * Fix issue with unclosed HTML tag ` Date: Wed, 18 Jun 2025 17:13:19 -0600 Subject: [PATCH 4/9] Attempt to fix changelog failure --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 0f254323f..0352a197c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,7 +10,7 @@ and this project adheres to the [Python Version Specification]: https://packaging.python.org/en/latest/specifications/version-specifiers/. See the [Contributing Guide](contributing.md) for details. -## [unreleased] +## [Unreleased] ### Fixed From 1e2504391f58eb65e2703c564aafaac2628c5923 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Wed, 18 Jun 2025 17:19:15 -0600 Subject: [PATCH 5/9] Escape only what is necessary --- markdown/htmlparser.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/markdown/htmlparser.py b/markdown/htmlparser.py index 9fb3c8335..478e70216 100644 --- a/markdown/htmlparser.py +++ b/markdown/htmlparser.py @@ -256,10 +256,9 @@ def handle_entityref(self, name: str): def handle_comment(self, data: str): # Check if the comment is unclosed, if so, we need to override position - # update i = self.line_offset + self.offset + len(data) + 4 if self.rawdata[i:i + 3] != '-->': - self.handle_data(''.format(data), is_block=True) @@ -268,7 +267,7 @@ def updatepos(self, i: int, j: int) -> int: if self.override_comment_update: self.override_comment_update = False i = 0 - j = 4 + j = 1 return super().updatepos(i, j) def handle_decl(self, data: str): From b6be2cd463654cfbc4c77b668cbd2bf654b78d9c Mon Sep 17 00:00:00 2001 From: facelessuser Date: Thu, 19 Jun 2025 07:03:42 -0600 Subject: [PATCH 6/9] Update changelog to reflect item is for Python 3.14 --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 0352a197c..60dc3ea66 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -14,7 +14,7 @@ See the [Contributing Guide](contributing.md) for details. ### Fixed -* Fix `codecs` deprecation. +* Fix `codecs` deprecation in Python 3.14. * Fix issue with unclosed comment parsing in Python 3.14. * Fix issue with unclosed declarations in Python 3.14. * Fix issue with unclosed HTML tag ` Date: Thu, 19 Jun 2025 07:03:49 -0600 Subject: [PATCH 7/9] Fix missing return --- markdown/extensions/md_in_html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/markdown/extensions/md_in_html.py b/markdown/extensions/md_in_html.py index 7a0ee5490..7eada6ffc 100644 --- a/markdown/extensions/md_in_html.py +++ b/markdown/extensions/md_in_html.py @@ -287,6 +287,7 @@ def parse_html_declaration(self, i: int) -> int: if result == -1: self.handle_data(self.rawdata[i:i + 1]) return i + 1 + return result # The same override exists in `HTMLExtractor` without the check # for `mdstack`. Therefore, use parent of `HTMLExtractor` instead. return super(HTMLExtractor, self).parse_html_declaration(i) From 23eea6d3c0c66664f115e74824834666bafb444a Mon Sep 17 00:00:00 2001 From: facelessuser Date: Thu, 19 Jun 2025 07:07:27 -0600 Subject: [PATCH 8/9] Add Python 3.14 test in CI --- .github/workflows/tox.yml | 5 +++-- tox.ini | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index bf6dc4d11..51ba8c51c 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false max-parallel: 4 matrix: - tox-env: [py39, py310, py311, py312, py313, pypy39, pypy310, pygments] + tox-env: [py39, py310, py311, py312, py313, py314, pypy39, pypy310, pygments] include: - tox-env: py39 python-version: '3.9' @@ -32,13 +32,14 @@ jobs: python-version: '3.12' - tox-env: py313 python-version: '3.13' + - tox-env: pygments + python-version: '3.14' - tox-env: pypy39 python-version: pypy-3.9 - tox-env: pypy310 python-version: pypy-3.10 - tox-env: pygments python-version: '3.11' - env: TOXENV: ${{ matrix.tox-env }} diff --git a/tox.ini b/tox.ini index 2cea38e38..7bc4f8db4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{39, 310, 311, 312, 313}, pypy{39, 310}, pygments, flake8, checkspelling, pep517check, checklinks +envlist = py{39, 310, 311, 312, 313, py314}, pypy{39, 310}, pygments, flake8, checkspelling, pep517check, checklinks isolated_build = True [testenv] From 4ca184958d159a0b1c55dafd55265bdd34475dd2 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Thu, 19 Jun 2025 07:09:49 -0600 Subject: [PATCH 9/9] Fix copy/paste issue --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 51ba8c51c..ba8f9f800 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -32,7 +32,7 @@ jobs: python-version: '3.12' - tox-env: py313 python-version: '3.13' - - tox-env: pygments + - tox-env: py314 python-version: '3.14' - tox-env: pypy39 python-version: pypy-3.9