title: HTML syntax errors highlight with javascript
body: <p>I'm building chrome extension for 3rd party website that is used by our content team.</p>
  
  <p>I need syntax highlight that will show <strong>SYNTAX ERRORS</strong> - e.g. broken html tags like <code>&lt; /span&gt;</code>, broken attributes like <code>href="http : //domain / page /"</code>, not properly eclosed tags. is it possible with javascript? </p>
  
  <p>as of now I'm using <code>highlight.js</code> with few regex replacements after its job done. any better solutions for this? how do I find missing enclosing tags?</p>
  
  <pre><code>$('.edit-definition').each(function (i, block) {
              hljs.highlightBlock(block);
              block.innerHTML = block.innerHTML
                  .replace(/(&amp;lt;\/\s)/g, "&lt;span class='hljs-red'&gt;$1&lt;/span&gt;") //spaces in the start of tag
                  .replace(/(\s+&gt;|\s+&amp;gt;)/g, "&lt;span class='hljs-red'&gt;$1&lt;/span&gt;") //spaces in the end of tag
                  .replace(/(http\s|https\s|\s+\/\/\s+|\s+\\\\\s+|\s+\/\s+|\s+\\\s+)/g, "&lt;span class='hljs-red'&gt;$1&lt;/span&gt;") //spaces in urls
          });
  </code></pre>