title: How to close html tags in JavaScript?
body: <p>I'm taking html content out of my database and displaying it on a page.</p>
  
  <p>Unfortunately these pages often have unclosed html tags and cause problems later when the page is rendered.</p>
  
  <p>I was wondering if there is a JavaScript implementation of something like <a href="http://tidy.sourceforge.net/" rel="nofollow">tidy</a> or <a href="http://htmlpurifier.org/" rel="nofollow">htmlpurifier</a>.</p>
  
  <p>Basically some software which can preferably close html tags in a string.</p>
  
  <p><strong>Edit:</strong> I'm not in a browser environment (node.js)</p>