Should leading and trailing spaces between backticks be preserved?

David Chambers david.chambers.05 at gmail.com
Sun Feb 13 15:31:34 EST 2011


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.



I should have been clearer. My experimentation revealed that browsers
respect the trailing space between the code tags but ignore the space
following the closing tag. The end result is one space rather than two. The
inverted example renders like so:

Added >>> to signify user input.

Not quite what we're after.

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.



John's examples suggest that this stripping should apply only within ``
double-backticked `` contexts. I imagine his intention was to avoid the
leading and trailing spaces in `` `foo` `` (required by the syntax) from
being included in the output. I can't imagine any reason to strip whitespace
in regular ` single-backticked ` contexts.

*Do others agree that stripping should occur only within double-backticked
contexts?* Perhaps we could get John to chime in.

David


On 13 February 2011 11:50, David Parsons <orc at pell.portland.or.us> wrote:


>

> 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

> _______________________________________________

> Markdown-Discuss mailing list

> Markdown-Discuss at six.pairlist.net

> http://six.pairlist.net/mailman/listinfo/markdown-discuss

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20110213/eaf1e4aa/attachment.html>


More information about the Markdown-Discuss mailing list