title: Handling Code Blocks with Markdown (Pagedown)
body: <p>I'm betting I'm using something incorrectly here...</p>
  
  <p>My MVC3 application uses <a href="http://code.google.com/p/pagedown/" rel="nofollow">Pagedown</a> to provide a javascript text editor, markdown converter, and live preview. I use its "santizer" object to strip potentially dangerous code just as suggested in instruction - you can see it at work in the <a href="http://pagedown.googlecode.com/hg/demo/browser/demo.html" rel="nofollow">demo</a>.</p>
  
  <p>The javascript code looks like this:</p>
  
  <pre><code>(function () {
      var converter1 = Markdown.getSanitizingConverter();
      var editor1 = new Markdown.Editor(converter1);
      editor1.run();
  })();
  </code></pre>
  
  <p>This code transforms a marked <code>textarea</code> tag into an editor, and uses the santizing converter to strip bad stuff. In some ways it seems to be working. Examples: </p>
  
  <ul>
  <li><code>marquee</code> tag as in the demo it is stripped properly.</li>
  <li><code>&lt;p style="font-size:40em;"&gt;Super Big Text&lt;/p&gt;</code> is stripped to <code>Super Big Text</code></li>
  </ul>
  
  <p>But something is not correct... when I insert a fake javascript like so:</p>
  
  <pre><code>TEXT `&lt;script type="text/javascript"&gt;alert("gotcha!");&lt;/script&gt;` MORE TEXT
  </code></pre>
  
  <p>and post the form, it bombs out with a yellow screen of death:</p>
  
  <p><code>Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted.</code></p>
  
  <p>Is this string not already encoded safely like <code>&amp;lgt;script</code>... etc.?</p>
  
  <p><strong>Question:</strong> What am I missing to ensure code blocks and inline code are properly transformed so that they may be posted to the server as a safe string?</p>