Can I define a class name on paragraph using Markdown?

Dupe: How do I set an HTML class attribute in Markdown?

Natively? No. But…

No, Markdown’s syntax can’t. You can set ID values with Markdown Extra through.

You can use regular HTML if you like, and add the attribute markdown="1" to continue markdown-conversion within the HTML element. This requires Markdown Extra though.

<p class="specialParagraph" markdown='1'>
**Another paragraph** which allows *Markdown* within it.

Possible Solution: (Untested and intended for <blockquote>)

I found the following online:


function _DoBlockQuotes_callback($matches) {


    //add id and class details...
    $id = $class="";
    if(preg_match_all('/\{(?:([#.][-_:a-zA-Z0-9 ]+)+)\}/',$bq,$matches)) {
        foreach ($matches[1] as $match) {
            if($match[0]=='#') $type="id";
            else $type="class";
            ${$type} = ' '.$type.'="'.trim($match,'.# ').'"';
        foreach ($matches[0] as $match) {
            $bq = str_replace($match,'',$bq);

    return _HashBlock(
    ) . "\n\n";


>{.className}{#id}This is the blockquote


<blockquote id="id" class="className">
    <p>This is the blockquote</p>

Leave a Comment