Should leading and trailing spaces between backticks be preserved?

David Parsons orc at pell.portland.or.us
Sun Feb 13 14:50:28 EST 2011



On Feb 13, 2011, at 11:28 AM, David Chambers wrote:


> Hi folks,

>

> Yesterday I raised an issue about inconsistent preservation of

> whitespace in Python-Markdown.

>

> >>> import markdown

> >>> md = markdown.Markdown()

> >>> md.convert('Added `>>> ` to signify user input.')

> u'<p>Added <code>&gt;&gt;&gt;</code> to signify user input.</p>'

>

> According to Waylan, all but one of the Markdown implementations

> drop the trailing slash within the backticks. This seems wrong to me.


Well, yes, it might be wrong, but that's how the language
works ("one after the opening, one before the closing" is what
<http://daringfireball.net/projects/markdown/syntax#code> says,
And it gives an example (`` `foo` ``) as well.

> I don't buy the argument that since default browser behaviour

> is to ignore this space,


Who makes that argument? If so, I think they're doing it
wrong; recent versions of firefox and safari don't ignore
trailing spaces in a code span, nor do recent versions of lynx.

And it's not as if there isn't a simple workaround, either;
if you want your text to be >>>_ (_ for space, of course)
there's the inelegant replacement of >>>__, which should see
the second space stripped off leaving you with the first one
(the extra-inelegant replacement is <code>>>> </code>, which
will sail happily through at least one markdown processor.)

-david parsons



-david parsons


More information about the Markdown-Discuss mailing list