Utility classes and functions

mtrchk.org.momotor.render.diff.mixin.diff_files(left, right, *, left_header='Left', right_header='Right', tabsize=4, wrapcolumn=60, context_lines=4, encoding=None, ignore_final_newline=False, font='Consolas,"Courier New",monospace')

Compare two files and return an HTML diff.

Parameters:
  • left (File) – Left-side file

  • right (File) – Right-side file

  • left_header (str) – Left-side header

  • right_header (str) – Right-side header

  • tabsize (int) – Tab size

  • wrapcolumn (int) – Column width

  • context_lines (int) – Amount of context to show on the diff. -1 for full diff

  • encoding (str) – Encoding to use when reading the files

  • ignore_final_newline (bool) – Ignore difference in final newline

  • font (str) – Font name(s) to use for the diff output. Multiple fonts can be specified, separated by commas

Return type:

tuple[str | None, str | None]

Returns:

The HTML diff and CSS