title: Building an HTML Diff/Patch Algorithm
body: <p>A description of what I'm going to accomplish: </p>
  
  <ul>
  <li>Input 2 (N is not essential) HTML documents. </li>
  <li>Standardize the HTML format</li>
  <li>Diff the two documents -- external styles are not important but anything inline to the document will be included. </li>
  <li>Determine delta at the HTML Block Element level. </li>
  </ul>
  
  <p>Expanding the last point: </p>
  
  <p>Imagine two pages of the same site that both share a sidebar with what was probably a common ancestor that has been copy/pasted. Each page has some minor changes to the sidebar. The diff will reveal these changes, then I can "walk up" the DOM to find the first common block element shared by them, or just default to <code>&lt;body&gt;</code>. In this case, I'd like to walk it up and find that, oh, they share a common <code>&lt;div id="sidebar"&gt;</code>. </p>
  
  <p>I'm familiar with DaisyDiff and the application is similar -- in the CMS world. </p>
  
  <p>I've also begun playing with the google diff-patch library. </p>
  
  <p>I wanted to give ask this kind of non-specific question to hopefully solicit any advise or guidance that anybody thinks could be helpful. Currently if you put a gun to my head and said "CODE IT" I'd rewrite DaisyDiff in Python and add-in this block-level logic. But I thought maybe there's a better way and the answers to <a href="https://stackoverflow.com/questions/31722/anyone-have-a-diff-algorithm-for-rendered-html">Anyone have a diff algorithm for rendered HTML?</a> made me feel warm and fuzzy. </p>