[kramdown-users] getting kramdown not to wrap with p tags

Matt Neuburg matt at tidbits.com
Sun Mar 28 18:30:59 EDT 2010

I'm having trouble figuring out how to tell kramdown not to wrap a paragraph
with <p> tags.

For example, consider this input (in this email, "==" delimits the start and
end of text input and is not a real set of characters):


<img src="hoho.png" />


The output is (ignoring whitespace):

<p><img src="hoho.png" /></p>

But that isn't what I want. I don't want the <img> tag wrapped in <p> tags.
It is legal for an img tag to exist outside of a paragraph and that is what
I want here.

I tried some workarounds but they don't work. In this particular example,
one possibility is to trick kramdown into ignoring the paragraph containing
the <img> tag by wrapping it in open and close <p> tags, like this:


<p></p><img src="hoho.png" /><p></p>


The hope is that the initial <p> tag will cause the whole paragraph to be
ignored by kramdown (this trick does work with Markdown). Unfortunately, the
output is:

<p />
<p><img src="hoho.png" /></p>

So that didn't work (and the output makes no sense to me in relation to the
input, but that's not important).

I feel sure that I'm missing something. The problem arises in several other
cases where a tag is a legal stand-alone (<br> tags, for example).


matt neuburg, phd = matt at tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
Take Control of Exploring & Customizing Snow Leopard
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com

More information about the kramdown-users mailing list