Closed edvorg closed 6 years ago
It's definitely possible. The annotations get attached to the AST which might look like this:
{:type :coll
:delim \(
:annotation :parens-added
:contents [{:type :symbol :text "foo" :annotation :added}
{:type :symbol :text "unchanged"}]}
You can get something like that to play around with in a repl like this:
(let [old (parse/parse-one "[:a :b :c]")
new (parse/parse-one "[:a :x :b :y :c :z]")
ann (diff/diff-forms old [new])]
(annotation/attach new ann))
It would be pretty easy to tweak the existing render function to do something with them (and also render the original whitespace). The difficult part would be that the way to report the diff annotations is probably different for different tools. I'm not sure that anyone writing such a diff tool would have expected this sort of thing so it could be tricky.
Thank you for pointing out, I'll look into it!
hi is there way to separate html related functionality and the core alogrithm in order to integrate this to diff tool? e.g. emacs ediff