How to fit the html output from difflib.HtmlDiff in one window without the scroll bar.
I am attaching my html output image in here: output html
How to fit the html output from difflib.HtmlDiff in one window without the scroll bar.
I am attaching my html output image in here: output html
For the horizontal scrollbar, you can reduce the width of the table using the optional wrapcolumn argument when creating the difflib.HtmlDiff object.
html_table = difflib.HtmlDiff(wrapcolumn=80).make_table(
expected,
actual,
)
If you meant the vertical scrollbar, you can reduce the height by using context=True in the make_table or make_file function call. You can tweak the numlines argument too if you want.
difflib.HtmlDiff doesn't provide much else for customization, and I've found it very difficult to customize the look using CSS. The HTML it generates is very archaic and inflexible.
https://docs.python.org/3/library/difflib.html#difflib.HtmlDiff
There are some suggestions for alternatives to difflib.HtmlDiff in this question, though.
There are a few things you can do.