title: escape blacklist html tags outside of code tags
body: <p>I have a (white)list of tags that I will allow as html <em>outside</em> of <code>code</code> tags. For any html written within <code>&lt;code&gt;</code> tags, I want to use regex in javascript to replace the &lt; and > characters with &amp;#60; and &amp;62;</p>
  
  <p>So the <code>&lt;b&gt;</code> symbols should be replaced within <code>&lt;code&gt;&lt;b&gt;bold&lt;/b&gt;&lt;/code&gt;</code>, but not the <code>&lt;code&gt;</code> tags themselves - they should remain as html.</p>
  
  <p>I don't want to allow the <code>&lt;script&gt;</code> tag outside of the <code>&lt;code&gt;</code> block, so I wont have 'script' in my whitelist. If the script tag is within the code tags, then the ascii replace should take place.</p>
  
  <p>This is quite similar to how the RTE works here on stackoverflow.</p>
  
  <p>I need to do this all client-side using javascript + regex. Any help would be much appreciated.</p>
  
  <p>Thanks</p>