https://github.com/python/cpython/commit/130fa4c94f41880fc17cda27e1878e28ddfdd65c
commit: 130fa4c94f41880fc17cda27e1878e28ddfdd65c
branch: 3.13
author: Wulian233 <[email protected]>
committer: hugovk <[email protected]>
date: 2025-03-14T12:27:13Z
summary:
[3.13] gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font
(GH-131221) (#131242)
(cherry picked from commit 7fd6160)
files:
A Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst
M Lib/difflib.py
M Lib/test/test_difflib_expect.html
diff --git a/Lib/difflib.py b/Lib/difflib.py
index ba0b256969ebff..33e7e6c165aa0c 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -1628,7 +1628,7 @@ def _line_pair_iterator():
</html>"""
_styles = """
- table.diff {font-family:Courier; border:medium;}
+ table.diff {font-family: Menlo, Consolas, Monaco, Liberation Mono,
Lucida Console, monospace; border:medium}
.diff_header {background-color:#e0e0e0}
td.diff_header {text-align:right}
.diff_next {background-color:#c0c0c0}
diff --git a/Lib/test/test_difflib_expect.html
b/Lib/test/test_difflib_expect.html
index 3e6a7b7a9933d6..12091206a2856d 100644
--- a/Lib/test/test_difflib_expect.html
+++ b/Lib/test/test_difflib_expect.html
@@ -9,7 +9,7 @@
content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
- table.diff {font-family:Courier; border:medium;}
+ table.diff {font-family: Menlo, Consolas, Monaco, Liberation Mono,
Lucida Console, monospace; border:medium}
.diff_header {background-color:#e0e0e0}
td.diff_header {text-align:right}
.diff_next {background-color:#c0c0c0}
diff --git
a/Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst
b/Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst
new file mode 100644
index 00000000000000..e821e61a0ca5ed
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst
@@ -0,0 +1 @@
+Use monospace font from System Font Stack for cross-platform support in
:class:`difflib.HtmlDiff`.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]