Skip to content

Commit e364a42

Browse files
authored
[3.12] gh-131204: Fix difflib.HtmlDiff may not use monospaced font (GH-131221) (#131243)
(cherry picked from commit 7fd6160)
1 parent 9a612a8 commit e364a42

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Lib/difflib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ def _line_pair_iterator():
16281628
</html>"""
16291629

16301630
_styles = """
1631-
table.diff {font-family:Courier; border:medium;}
1631+
table.diff {font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; border:medium}
16321632
.diff_header {background-color:#e0e0e0}
16331633
td.diff_header {text-align:right}
16341634
.diff_next {background-color:#c0c0c0}

Lib/test/test_difflib_expect.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
content="text/html; charset=utf-8" />
1010
<title></title>
1111
<style type="text/css">
12-
table.diff {font-family:Courier; border:medium;}
12+
table.diff {font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; border:medium}
1313
.diff_header {background-color:#e0e0e0}
1414
td.diff_header {text-align:right}
1515
.diff_next {background-color:#c0c0c0}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use monospace font from System Font Stack for cross-platform support in :class:`difflib.HtmlDiff`.

0 commit comments

Comments
 (0)