Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store as diff, display as HTML #91

Open
retronoodle opened this issue Nov 18, 2017 · 1 comment
Open

Store as diff, display as HTML #91

retronoodle opened this issue Nov 18, 2017 · 1 comment

Comments

@retronoodle
Copy link

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!

@samg
Copy link
Owner

samg commented Nov 22, 2017

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants