I'm using Redcarpet Markdown 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.
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.
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?
Example Update
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 class="cool">
<b>Hello world</b> <a href="http://google.com">Google</a>
</p>
There are 2 possible solutions, but I don't know how to do them with Redcarpet Markdown:
Get special markdown syntax for classes, eg:
{class: cool}
**Hello world** [Google](http://google.com)
Allow Markdown to work within HTML elements:
<p class="cool">
**Hello world** [Google](http://google.com)
</p>
Currently I'm just doing such elements in pure HTML without markdown. But how can I get #1 or #2 to work?