rtfpessoa / diff2html

Pretty diff to html javascript library (diff2html)
https://diff2html.xyz
MIT License
2.87k stars 278 forks source link

Show "no newline at end of file" warning #157

Open dverbru opened 6 years ago

dverbru commented 6 years ago

Show "no newline at end of file" warning like in GitHub.


Step 1: Describe the problem:

Often text editors add new lines at EOF to comply with UNIX standard as git expects. When such newlines are introduced (or accidentally removed) to an already tracked file, this diff viewer doesn't offer a visual clue about that missing invisible character. Please note that git-diff shows a warning for this case in the terminal and GitHub supports it on their diff viewer.

Steps to reproduce:

  1. Create a text file that does not end with a new line character and commit it.
  2. Add a new line at the end of that file and commit it.
  3. Perform the diff with diff2html CLI.

Observed Results:

Expected Results:

rtfpessoa commented 6 years ago

@dverbru that makes complete sense. PRs are welcome 😄