]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font (#131221)
authorWulian233 <1055917385@qq.com>
Fri, 14 Mar 2025 10:45:33 +0000 (18:45 +0800)
committerGitHub <noreply@github.com>
Fri, 14 Mar 2025 10:45:33 +0000 (10:45 +0000)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Lib/difflib.py
Lib/test/test_difflib_expect.html
Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst [new file with mode: 0644]

index bc09aa128aa6d98d8290d83f0dd048d04a96ea68..4bba9e7ea5cfa828d8a0feb4843ce6f8e01a80db 100644 (file)
@@ -1633,7 +1633,7 @@ _file_template = """
 
 _styles = """
         :root {color-scheme: light dark}
-        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}
index 6c2ee49837e68917fd0b161da096242b4538d0d3..9f33a9e9c9cf587948853ea508c834231f55da00 100644 (file)
@@ -10,7 +10,7 @@
     <title></title>
     <style type="text/css">
         :root {color-scheme: light dark}
-        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 (file)
index 0000000..e821e61
--- /dev/null
@@ -0,0 +1 @@
+Use monospace font from System Font Stack for cross-platform support in  :class:`difflib.HtmlDiff`.