Whitespace in img src

Waylan Limberg waylan at gmail.com
Mon Feb 25 21:56:31 EST 2008

On 25 Feb 2008 16:45:23 -0800, david parsons <orc at pell.portland.or.us> wrote:

> In article <nemoMon022508103428 at news.lrz-muenchen.de>,


> Florian Lindner <markdown-discuss at six.pairlist.net> wrote:

> >Hello,

> >markdown (Python implementation) seems to render:

> >

> >![alternativer text](pfad/und/eine lange/url zum bild.jpg)

> >

> >to

> >

> ><img src="pfad/und/eine" title="lange/url zum bild.jpg"

> >alt="alternativer text"/>

> >

> >breaking the URL at the whitespace. AFAIK whitespaces are ok in URLs

> >so why is it breaking up the URL here?


> Because spaces are how it separates the url from the title text?


Yup, thats why. Although quotes are acceptable as well. The only way
to do the encoding of spaces is to always require quotes around the
title text. A quick look at the syntax rules indicates that quotes
should always be required and I could change python-markdown's
behavior to follow. However, there may be a significant number of
documents that have been created over the years that rely on the use
of a space only to separate the title. A change of that behavior would
break all those documents. On the other hand, url's with spaces would
be very unusual and are generally considered a bad idea, so I'm not
inclined to NOT make that change unless I get sufficiant demand for
it. Perhaps the other python-markdown dev would feel different.

Personally, I'd suggest a change in your urls. Perhaps replace the
spaces with the underscore `_`. If that's not possible or beyond your
control, then encode the urls manually. If you really must have the
spaces, then it would be *vary easy* (relatively speaking) to write
your own extension using python-markdown's extension api.

Waylan Limberg
waylan at gmail.com

More information about the Markdown-Discuss mailing list