GeezerVison is showing github.com — gh-134580: Modernizing `difflib.HtmlDiff` for HTML Output by Wulian233 · Pull Request #134581 · python/cpython
Conversation
Wulian233
commented
May 23, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Improved the styling of HTML diff pages generated by the difflib.HtmlDiff` class, and migrated the output to the HTML5 standard.
And all browser warnings have been eliminated.
details see: #134580
Request review @hugovk thanks!
Screenshot:
Details
Before:

After:

Before:

After:

📚 Documentation preview 📚: https://cpython-previews--134581.org.readthedocs.build/
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks, I think this is an improvement.
Before
After
And
Here's a GitHub diff:
Similarly, I think we should keep the lines a bit tighter together.
Here's the PR with the vertical padding removed:
Shall we remove that padding?
And shall we centre the table on the page?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Wulian233
commented
May 23, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Similarly, I think we should keep the lines a bit tighter together.
Here's the PR with the vertical padding removed:
It's a good improvement, and this is what it looks like now

And shall we centre the table on the page?
I before thought about this, but the table width is determined based on the length of the content and the code specified, like
'<h2>tabsize=2</h2>',
j.make_table(f2,t2),
'<h2>tabsize=default</h2>',

If we center the table, there will be a lot of space on both sides of the screen, and it may not be as easy to distinguish as if the table is narrow. So I didn't do that, and my opinion is also to keep the left alignment the way :)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
auto-merge was automatically disabled
May 27, 2025 22:23 Head branch was pushed to by a user without write access
Reviewers
hugovk
hugovk approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|