[kramdown-users] Proposal: block level image tag

Thomas Leitner t_leitner at gmx.at
Thu Jul 15 10:24:46 EDT 2010

> Thinking about this further, I find a couple issues with this
> proposal which concern me.
> First, what about the case of a stand-alone clickable image?
>    [![caption](foo.png)](http://www.example.com/)
> I suspect this to be about as common as the stand-alone non-clickable 
> image case.  Should this be recognized specially too?
> Second, and more seriously, a block-level <img/> tag does not
> validate under strict document types, such as "HTML 4.01 Strict" or
> "XHTML 1.0 Strict". I feel quite hesitant about recommending that
> kramdown generate non-validating HTML mark-up as its default behavior
> (especially since I always use "strict" for my websites). One
> solution to this issue would be for kramdown to wrap the stand-alone
> <img/> automatically in a <div> for HTML output, and (as requested)
> in \begin{figure} for LaTeX output. The enclosing <div> would be
> equally valid for strict and non-strict document types.

You are right, <img/> tags are only allowed inside elements with the
Flow/Inline content model and <body> has the Block content model. Since this
was basically a request on the side of LaTeX conversion, what about
just leaving nearly everything as-is and just recognizing "block level"
image tags only in the LaTeX converter, i.e.:



gets converted to HTML like this (no difference to current output):

    <p><img alt="caption" src="foo.png" /></p>

    <p><a href="http://www.example.com"><img alt="caption" src="foo.png" /></a></p>

and to LaTeX like this (first part is different):



-- Thomas

More information about the kramdown-users mailing list