[kramdown-users] Proposal: block level image tag

Thomas Leitner t_leitner at gmx.at
Thu Jul 15 02:21:15 EDT 2010


On 2010-07-05 13:04 +0200 Michael Franzl wrote:
> On 07/05/2010 11:05 AM, Thomas Leitner wrote:
> > Images are currently included using `\includegraphics`. What would
> > be the benefit of using the `figure` environment? Would there be a
> > problem with images used between text parts?
> 
> The benefit would be that the supplied image text is not lost. It
> would be placed as caption above or below the image.
> 
> Usually the caption is below the image, like this:
> 
>      \begin{figure}
>        \includegraphics{image.jpg}
>        \caption{alt text}
>      \end{figure}

Okay, this creates a figure which is placed outside of the text flow.
However, all images that can appear in kramdown can currently only
appear *inside* a paragraph and should therefore be shown inside a
paragraph, i.e. by just using a plain `\includegraphics` command.

What I could do is to change the current behaviour of kramdown to allow
standalone, ie. block level, images. A block level image (in contrast to
a span level image that flows with the text) would be created by
placing an image link as the only element inside a paragraph, ie:

    This is a para with ![alt text](image.jpg) and image.

    ![alt text](image.jpg)

    The above paragraph contains only an image and therefore will be
    converted to a block level image tag.

This would also mitigate an issue raised by Eric Sunshine when
converting a HTML fragment to kramdown which contains a standalone
image tag.

Such block level images could then be rendered inside a figure
environment when outputting LaTeX code.

Note, however, that the above change would not allow an image to be the
only element inside a paragraph - anyone having a use case for such a
situation?

-- Thomas


More information about the kramdown-users mailing list