[3.13] gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font (GH-131221) (#131242)

(cherry picked from commit 7fd6160)
This commit is contained in:
Wulian233 2025-03-14 20:27:13 +08:00 committed by GitHub
parent a3ca70c527
commit 130fa4c94f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View File

@ -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}

View File

@ -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}

View File

@ -0,0 +1 @@
Use monospace font from System Font Stack for cross-platform support in :class:`difflib.HtmlDiff`.