[Kramdown-users] Markdown processing within HTML

Eric Sunshine sunshine at sunshineco.com
Thu Nov 26 21:48:22 EST 2009


Hi Thomas,

I am finding that kramdown's default processing of Markdown within 
block-level HTML elements tends to be painful. For instance, given the 
legitimate embedded HTML:

<ul>
<li>Item</li>
</ul>
<dl>
<dt>Foo</dt>
<dd>cow</dd>
</dl>

kramdown emits the following invalid output:

<ul>
   <p><li>Item</li></p>
</ul>
<dl>
   <p><dt>Foo</dt>
<dd>cow</dd></p>
</dl>

By invalid, I mean that this output is structurally incorrect and will 
not pass w3c.org validation. It seems unfortunate that one should have 
to litter {::nokramdown:} throughout the document to avoid such 
situations. The original Markdown's decision to inhibit processing 
within block-level elements seems far less intrusive.

Even the simple case of <div>...</div> being transformed into 
<div><p>...</p></div> by kramdown by default is potentially undesirable. 
Typically, when going to the effort of manually coding a <div>...</div> 
block, one typically wants it preserved as typed, without the extra 
block-level element (<p>...</p>) being inserted.

Rather than performing Markdown processing by default in block-level 
elements, perhaps it might make more sense to have a complementary 
{::kramdown:} which re-enables processing with the element. Alternately, 
something skin to Maruku's <div markdown="1">...</div> (for any 
block-level element) might be suitable.

-- ES


More information about the Kramdown-users mailing list