Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 15346cd3a73f108bf11c57907b32737f8365d6bd Mon Sep 17 00:00:00 2001
From: facelessuser <faceless.shop@gmail.com>
Date: Mon, 21 Jul 2025 08:56:43 -0600
Subject: [PATCH] Fix failing cases for Python 3.14

New change requires us to monkey patch `locatetagend` to prevent
capturing incomplete tags in code spans.

Upstream: https://github.com/Python-Markdown/markdown/pull/1548
(released in Python-Markdown 3.9.0)

The `docs/changelog.md` hunk of the upstream commit is dropped as the
file is not shipped in the sdist used here.
---
markdown/htmlparser.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/markdown/htmlparser.py b/markdown/htmlparser.py
index 478e70216..63e5df31b 100644
--- a/markdown/htmlparser.py
+++ b/markdown/htmlparser.py
@@ -69,6 +69,20 @@ htmlparser.locatestarttagend_tolerant = re.compile(r"""
)?
\s* # trailing whitespace
""", re.VERBOSE)
+htmlparser.locatetagend = re.compile(r"""
+ [a-zA-Z][^`\t\n\r\f />]* # tag name
+ [\t\n\r\f /]* # optional whitespace before attribute name
+ (?:(?<=['"\t\n\r\f /])[^`\t\n\r\f />][^\t\n\r\f /=>]* # attribute name
+ (?:= # value indicator
Comment thread
kgodara912 marked this conversation as resolved.
+ (?:'[^']*' # LITA-enclosed value
+ |"[^"]*" # LIT-enclosed value
+ |(?!['"])[^>\t\n\r\f ]* # bare value
+ )
+ )?
+ [\t\n\r\f /]* # possibly followed by a space
+ )*
+ >?
+""", re.VERBOSE)

# Match a blank line at the start of a block of text (two newlines).
# The newlines may be preceded by additional whitespace.
--
2.51.0

12 changes: 7 additions & 5 deletions SPECS/python-markdown/python-markdown.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
Summary: Markdown implementation in Python
Name: python-%{pkgname}
Version: 3.8.2
Release: 2%{?dist}
Release: 3%{?dist}
License: BSD-3-Clause
Vendor: Microsoft Corporation
Distribution: Azure Linux
URL: https://python-markdown.github.io/
Source0: https://github.com/Python-Markdown/markdown/releases/download/%{version}/%{pkgname}-%{version}.tar.gz#/python-%{srcname}-%{version}.tar.gz
BuildArch: noarch
Patch0: 0001-fix-pyproject-license-for-setuptools.patch
Patch1: 0002-Fix-handling-of-incomplete-HTML-tags-in-code-spans.patch

%description
This is a Python implementation of John Grubers Markdown. It is
Expand All @@ -37,9 +38,6 @@ there are a few known issues.

%prep
%autosetup -p1 -n %{pkgname}-%{version}
# Skip 2 tests that fail due to Python 3.12 html.parser behavior changes
sed -i 's/def test_raw_missing_close_bracket/def _skip_test_raw_missing_close_bracket/' tests/test_syntax/blocks/test_html_blocks.py
sed -i 's/def test_unclosed_comment_/def _skip_test_unclosed_comment_/' tests/test_syntax/blocks/test_html_blocks.py

%build
%pyproject_wheel
Expand All @@ -53,7 +51,6 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} \
LICENSE.md > LICENSE.html

%check
# Skip test_raw_missing_close_bracket and test_unclosed_comment_ (Python 3.12 html.parser changes)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🥇

%{__python3} -m unittest discover -v


Expand All @@ -66,6 +63,11 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{_bindir}/markdown_py

%changelog
* Thu Sep 10 2026 Kshitiz Godara <kgodara@microsoft.com> - 3.8.2-3
- Add upstream patch (PR #1548) to fix incomplete HTML tags in code spans
with the new html.parser backported into Python 3.12.14.
- Drop the %%prep test skips, no longer needed with Python 3.12.14.

* Wed Jun 17 2026 Kshitiz Godara <kgodara@microsoft.com> - 3.8.2-2
- Use %%{pkgname} (lowercase) for %%autosetup -n so the directory inside
the upstream tarball (markdown-3.8.2) matches; skip 2 tests broken by
Expand Down
Loading