--- node.inc	2008-04-08 11:01:57.000000000 -0300
+++ node.inc	2009-03-10 10:07:37.000000000 -0300
@@ -20,9 +20,52 @@ function node_diff(&$old_node, &$new_nod
   if ($type->has_body) {
     $result['body'] = array(
       '#name' => $type->body_label,
-      '#old' => explode("\n", $old_node->body),
-      '#new' => explode("\n", $new_node->body),
+      '#old' => explode("\n", node_diff_strip_html($old_node->body)),
+      '#new' => explode("\n", node_diff_strip_html($new_node->body)),
     );
   }
   return $result;
 }
+
+/**
+ * Insert newlines in HTML, replace special characters and remove all tags.
+ */
+function node_diff_strip_html($text) {
+
+  // Replace HTML breaks with newlines
+  $text = str_replace("<br/>", "\n", $text);
+
+
+  //EFD ADDDED - replace more BR's 
+  //(maybe would work better as an array of tags or module setting)
+  $text = str_replace("<br />", "\n", $text);
+  $text = str_replace("<br>", "\n", $text);
+  
+  // Replace list elements with newlies
+  $text = str_replace("</li>", "\n", $text);
+  // Replace paragraphs with newlies
+  $text = str_replace("</p>", "\n", $text);
+  // Replace table cells with newlines
+  $text = str_replace("</td>", "\n", $text);
+  // Replace divs with newlines
+  $text = str_replace("</div>", "\n", $text);
+
+  // Replace image tags with the image location
+  // Todo: maybe alt and title attribute can also be displayed
+  $text = preg_replace('#<img(.*)(src="([^"]+)")([^/]*)/>#', '[image:$3]', $text);
+
+  // Replace link tags with the link location
+  // Todo: maybe title attribute can also be displayed
+  $text = preg_replace('#<a(.*)(href="([^"]+)")([^>]*)>#', '[link:$3]', $text);
+  // Replace link endings
+  $text = str_replace("</a>", "[link]", $text);
+
+  // Todo: check if other tags need special treatment as well
+  // Strip all remaining tags
+  
+  $text = preg_replace("#</?[a-zA-Z]+(\s[^>]*)?>#", "", $text);
+  // Todo: Test the generic solution using html_entity_decode() it seems it's working ok, not tested deeply enough to know
+  $text = html_entity_decode($text, ENT_QUOTES, "UTF-8");
+  
+  return $text;
+}
