[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?
>
> [](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.:

[](http://www.example.com)
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):
\begin{figure}
\includegraphics{foo.png}
\caption{caption}
\end{figure}
\href{http://www.example.com}{\includegraphics{foo.png}}
-- Thomas
More information about the kramdown-users
mailing list