samg / diffy

Easy Diffing in Ruby
http://rubygems.org/gems/diffy
MIT License
1.27k stars 104 forks source link

Diffs with literal \n cause extra line breaks in diff #113

Open JasonBarnabe opened 3 years ago

JasonBarnabe commented 3 years ago
# Note single quotes - \n is not a line break.
puts Diffy::Diff.new('foo\nbar', 'boo\nfar').to_s(:html)

Expected:

<div class="diff">
  <ul>
    <li class="del"><del><strong>foo\nb</strong>ar</del></li>
    <li class="ins"><ins><strong>boo\nf</strong>ar</ins></li>
  </ul>
</div>

Actual:

<div class="diff">
  <ul>
    <li class="del"><del><strong>f</strong>oo</del></li>
    <li class="del"><del><strong>b</strong>ar</del></li>
    <li class="ins"><ins><strong>b</strong>oo</ins></li>
    <li class="ins"><ins><strong>f</strong>ar</ins></li>
  </ul>
</div>
cristianocca commented 1 year ago

Any updates or work arounds for this?

ErCargo commented 1 year ago

  您好,邮件已收到!

panozzaj commented 1 week ago

Perhaps the same or similar to https://github.com/samg/diffy/issues/96