title: Safely insert line breaks into HTML
body: <p>I have an application allows a user to copy paste html into a form. This html gets sent as an email, and the <a href="http://www.eggheadcafe.com/software/aspnet/30386381/smtp-exchange-2000-1000-characters-per-line-truncation.aspx" rel="nofollow">email server will not allow more than 1000 characters per line</a>. So, I'd like to insert line breaks (\r\n) into the html after the user has hit submit. How can I do this without changing the content?</p>
  
  <p>My idea is this:</p>
  
  <pre><code>html.replace('&lt;', '\r\n&lt;');
  </code></pre>
  
  <p>But is that guaranteed to not change the result? Is '&lt;' not allowed in attributes?</p>
  
  <p><strong>Edit</strong>: I'm actually thinking this will not work because the html could have a script block with something like if(x &lt; 3). I guess what I need is an html pretty printer that works in either js or C#.</p>