https://github.com/python/cpython/commit/7fd61607cd28ec466717c78adfb1eb5b63add1f0 commit: 7fd61607cd28ec466717c78adfb1eb5b63add1f0 branch: main author: Wulian233 <1055917...@qq.com> committer: hugovk <1324225+hug...@users.noreply.github.com> date: 2025-03-14T10:45:33Z summary:
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+hug...@users.noreply.github.com> 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 bc09aa128aa6d9..4bba9e7ea5cfa8 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1633,7 +1633,7 @@ def _line_pair_iterator(): _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 6c2ee49837e689..9f33a9e9c9cf58 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 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 -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com