title: Using markdown properly in a PHP application
body: <p>I work on a web application that uses Markdown as its syntax, the only issue I am facing is how to validate the user input on the server side so that it is actually Markdown and not some XSS attack that could be injected using a POST request or by disabling javascript.</p>
  
  <p>I know StackOverflow does this but how do they do it and allow certain HTML tags including images that are prone to XSS attacks? Any open source package that can help (examples appreciated).</p>
  
  <p>Becaue I heard that StackOverflow uses it, I will be trying out <a href="http://code.google.com/p/pagedown/" rel="nofollow">Pagedown</a> as client side validator.</p>