I\'d like to convert the output of diff
(on a Markdown file) to
Markdown with
and tags, so that I can see what h
Use wdiff. It already does the word-by-word comparison you're looking for; converting its output to markdown should take just a few simple regular expressions.
For example:
$ cat foo
Why do we study programming languages? Not in order to
$ cat bar
We study programming languages not in order to
$ wdiff foo bar
[-Why do we-]{+We+} study programming [-languages? Not-] {+languages not+} in order to
$ wdiff foo bar | sed 's|\[-||g;s|-]||g;s|{+||g;s|+}||g'
Why do weWe study programming languages? Not languages not in order to
Edit: Actually, wdiff has some options that make it even easier:
$ wdiff -w '' -x '' -y '' -z '' foo bar
Why do weWe study programming languages? Not languages not in order to