Aeolun / react-diff-viewer-continued

A simple and beautiful text diff viewer component made with Diff and React.
https://aeolun.github.io/react-diff-viewer-continued/
MIT License
113 stars 34 forks source link

Compare method does not seem to be working #18

Open sciofu opened 1 year ago

sciofu commented 1 year ago

Hello, I've been trying to make the diff-viewer highlight trailing spaces and newlines, but it does not seem to be able to do that.

I tried using different compareMethod values, DiffMethod.WORDS_WITH_SPACE seemed to be the right one. However, it did not do the job.

I also tried separately to use the the method from the diff package, and that managed to return the trailing characters.

Is it something that I am missing? Should I also use it alongside other relevant props?

Cheers!

Aeolun commented 1 year ago

It might be eating the diffed spaces due to it being HTML. Let me check.

kevinlu1248 commented 1 week ago

I think the custom diff render is also not working. As a way to repro, you can try setting it to (originalCode: string, newCode: string): jsdiff.Change[] => { return []; } and the diff won't disappear.