title: Rendering raw html with Redcarpet and Markdown
body: <p>I'm using <a href="https://github.com/vmg/redcarpet" rel="nofollow">Redcarpet</a> as a Markdown renderer and I would like to be able to display html or any text with &lt; and > without it to be parsed.</p>
  
  <p>Here is an illustration of what should happen:</p>
  
  <p>The user types </p>
  
  <pre><code>I *want* to write &lt;code&gt;
  </code></pre>
  
  <p>The source of this comment when sent back by the server should be</p>
  
  <pre><code>I &lt;em&gt;want&lt;/em&gt; to write &amp;lt;code&amp;gt;
  </code></pre>
  
  <p>Problem is since the renderer outputs escaped html when parsing the Markdown, I get:</p>
  
  <pre><code>I &amp;lt;em&amp;gt;want&amp;lt;/em&amp;gt; to write &amp;lt;code&amp;gt;
  </code></pre>
  
  <p>Therefore I can't distinguish between the html that people send to the server and the html that is generated by the Redcarpet renderer. If I do a <code>.html_safe</code> on this, my markdown will be interpreted but the user-inputted html too, which shouldn't.</p>
  
  <p>Any idea on how to fix this?
  Note that the idea would be to display (but not parse) user-inputted html even if the user didn't use the backticks ` as expected with markdown.</p>
  
  <p>Here is the relevant bit of code :
  </p>
  
  <pre><code># this is our markdown helper used in our views
  def markdown(text, options=nil)
      options = [:no_intra_emphasis =&gt; true, ...]
  
      renderer = MarkdownRenderer.new(:filter_html =&gt; false, ...)
  
      markdown = Redcarpet::Markdown.new(renderer, *options)
      markdown.render(text).html_safe
  end
  </code></pre>