[Kramdown-users] Markdown processing within HTML

Thomas Leitner t_leitner at gmx.at
Fri Nov 27 02:26:00 EST 2009

> 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>

I have added li, dt and dd to the list of HTML tags recognized as block
level HTML tags. With this change the above works as expected.

> 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.

The implementation of the markdown="0|1|block|span" feature is on my
TODO list and will make it into the 0.2.0 release. I will also add an
option for setting whether block and span HTML tags are automatically
parsed by kramdown.

Regarding the {::kramdown:} element: since kramdown syntax will then
not be parsed in the element, the {::kramdown:} element won't also be

I will probably just change the default
kramdown-syntax-in-HTML-parsing to false. 

-- Thomas

More information about the Kramdown-users mailing list