title: How to Modify Redcarpet Markdown so it can handle classes?
body: <p>I'm using <a href="https://github.com/vmg/redcarpet">Redcarpet Markdown</a> on my Rails site. Often I'd like to add classes (or other attributes) to a paragraph, table or other element, but it doesn't allow it. If I replace the markdown element with HTML, then I need to replace the inside markdown with HTML too, which is a nuisance. </p>
  
  <p>For example, I want to add the class "table" to the markdown table element (so it get's Bootstrap's table styling), but then I'll need to replace the Markdown table with HTML. </p>
  
  <p>What's the simplest solution to this? Is there an easy way to modify the Markdown so it can handle classes? Alternatively, is there a way to allow Markdown inside an HTML element?</p>
  
  <p><strong>Example Update</strong>  </p>
  
  <p>I want to add a class to a div, table or paragraph, but still keep markdown inside the element. For example, I want to generate the following HTML:</p>
  
  <pre><code>&lt;p class="cool"&gt;
    &lt;b&gt;Hello world&lt;/b&gt; &lt;a href="http://google.com"&gt;Google&lt;/a&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>There are 2 possible solutions, but I don't know how to do them with Redcarpet Markdown:</p>
  
  <ol>
  <li><p>Get special markdown syntax for classes, eg:</p>
  
  <p><code>{class: cool}</code><br>
  <code>**Hello world** [Google](http://google.com)</code></p></li>
  <li><p>Allow Markdown to work within HTML elements:</p>
  
  <p><code>&lt;p class="cool"&gt;</code><br>
     <code>**Hello world** [Google](http://google.com)</code><br>
  <code>&lt;/p&gt;</code></p></li>
  </ol>
  
  <p>Currently I'm just doing such elements in pure HTML without markdown. But how can I get #1 or #2 to work?</p>