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

Something is wrong when there is bold text #5

Open
krzkrzkrz opened this issue Sep 21, 2011 · 2 comments
Open

Something is wrong when there is bold text #5

krzkrzkrz opened this issue Sep 21, 2011 · 2 comments

Comments

@krzkrzkrz
Copy link

Something is wrong when there is bold text (text surrounded by the <strong> element). Take for example:

a = "<p>adfadf<br>\n222<br>\nfoo <strong>bar</strong> was <code>here</code> 333<br>\nhere too<br>\n444<br>\n55 <strong>bold text added</strong><br>\n66</p>\n"
b = "<p>adfadf<br>\n222<br>\nfoo <strong>bar</strong> was <code>here</code> 333<br>\nhere too<br>\n444<br>\n55<br>\n66</p>\n"
Differ.diff_by_word(a, b).format_as(:html).html_safe

The following renders as:

<p>adfadf<br>
222<br>
foo <strong>bar</strong> was <code>here</code> 333<br>
here too<br>
444<br>
55<del class="differ">&lt;</del><ins class="differ"> <strong>bold text added</strong>&lt;</ins>br&gt;
66</p>

Notice the &lt; characters. Is this normal? Which renders in the browser inappropriately...

@krzkrzkrz
Copy link
Author

This is fixed if I do diff by line, and not by word. Strange...

@kolen
Copy link

kolen commented Jun 29, 2020

It's not designed to be HTML-aware and diffs raw strings. So, tags might be unmatched, or even cut in the middle, this is normal.
Outputting source tags as-is in html output is probably a bug: #15.

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