diff options
author | Wulian233 <1055917385@qq.com> | 2025-03-14 10:45:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-14 10:45:33 (GMT) |
commit | 7fd61607cd28ec466717c78adfb1eb5b63add1f0 (patch) | |
tree | 11ab016f02011aae9aec8e7e88c5dd1845049b30 | |
parent | 3d797e49c863c26d4d754e970ce6351465a7f50f (diff) | |
download | cpython-7fd61607cd28ec466717c78adfb1eb5b63add1f0.zip cpython-7fd61607cd28ec466717c78adfb1eb5b63add1f0.tar.gz cpython-7fd61607cd28ec466717c78adfb1eb5b63add1f0.tar.bz2 |
gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font (#131221)
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>
-rw-r--r-- | Lib/difflib.py | 2 | ||||
-rw-r--r-- | Lib/test/test_difflib_expect.html | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py index bc09aa1..4bba9e7 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -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} diff --git a/Lib/test/test_difflib_expect.html b/Lib/test/test_difflib_expect.html index 6c2ee49..9f33a9e 100644 --- a/Lib/test/test_difflib_expect.html +++ b/Lib/test/test_difflib_expect.html @@ -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 index 0000000..e821e61 --- /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`. |