diffy icon indicating copy to clipboard operation
diffy copied to clipboard

Store as diff, display as HTML

Open retronoodle opened this issue 8 years ago • 1 comments

Hi there, awesome gem - thank you!

I'd like to store my diffs in a DB as plain text diffs to make them smaller, more portable, etc. This part is easy.

But then, I'd like to pull them out of the DB and display them as HTML - basically with the same output as

Diffy::Diff.default_format = :html

Would give me. I don't want to redo the diff (the info that created the diff is gone at this point).

Maybe something like

Diffy::Diff.convert(stored_diff).to_s(:html)

Seems like I might be missing something or someone else might have solved this problem.

Right now, I am storing the diff as HTML but that wouldn't be as cool b/c later I'd have to strip out the html to display it in a txt environment.

Much thanks!

retronoodle avatar Nov 18 '17 19:11 retronoodle

You might be able to do this by invoking the HTML formatter directly.

Something like: Diffy::HtmlFormatter.new(myDiff)

samg avatar Nov 22 '17 00:11 samg