FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-134580: Modernizing `difflib.HtmlDiff` for HTML Output by Wulian233 · Pull Request #134581 · python/cpython · GitHub

Repository navigation

gh-134580: Modernizing difflib.HtmlDiff for HTML Output - #134581

Merged
hugovk merged 4 commits into
python:mainfrom
Wulian233:difflib-html
May 28, 2025
Merged

hugovk merged 4 commits into
python:mainfrom
Wulian233:difflib-html

Conversation

Wulian233 commented May 23, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

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/

hugovk commented May 23, 2025

Copy link
Copy Markdown
Member

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?

Wulian233 commented May 23, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

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>',

             '<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 :)

Comment thread Lib/difflib.py Outdated
hugovk enabled auto-merge (squash) May 27, 2025 14:23
auto-merge was automatically disabled May 27, 2025 22:23

Head branch was pushed to by a user without write access

hugovk merged commit 7ca6d79 into python:main May 28, 2025
Wulian233 deleted the difflib-html branch May 28, 2025 04:55
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…on#134581)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…on#134581)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
…on#134581)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL