google / diff-match-patch

Diff Match Patch is a high-performance library in multiple languages that manipulates plain text.
Apache License 2.0
7.39k stars 1.1k forks source link

Newbie, needs advice on line mode c# and markdown #116

Open EccentricDyslexic opened 3 years ago

EccentricDyslexic commented 3 years ago

Hey peeps,

I i’m a novice programmer in C sharp I’m trying to compare to text strings stored in a database in markdown and compare them line by line. Then I’d like to be able to interpret the result so that I can add annotation in markdown to the result, for example if two lines are the same, then there is no annotation or highlighting of that lone, if a line has been deleted then it’s shown in markdown being struck-through with a line, if a line has been added it is annotated highlighted in green, or something similar that makes some kind of sense. Any help gratefully received:-) steve@dvnbikers.fr

dmsnell commented 3 years ago

@EccentricDyslexic good luck with whatever you are doing. a couple points here:

Does that help?

EccentricDyslexic commented 3 years ago

Hi, I appreciate the help, I will have a look at it shortly, I am squashing bugs at the moment! It’s a feature I want to add into a web app I have for my document management system. I am sure I will get back to you shortly:-) Cheers Steve

Sent from my iPad Pro

On 16 Aug 2021, at 17:18, Dennis Snell @.***> wrote:

 @EccentricDyslexic good luck with whatever you are doing. a couple points here:

remember that Markdown shares syntax with HTML and thus you can find some changes with newlines and whitespace that don't change the semantic meaning of the content. a diff of the Markdown markup might reveal changes where the different outputs are identical you can use the output from line mode from diff-match-patch and process it to get those results. the output is straight-forward with insert, delete, and equal indicators for each chunk/line. you'd need to interpret that output yourself though, meaning you take the diff output and print out HTML/Markdown with the appropriate annotations on your own Does that help?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.