David Chambers
2011-Feb-13 19:28 UTC
Should leading and trailing spaces between backticks be preserved?
Hi folks, Yesterday I raised an issue about inconsistent preservation of whitespace<http://www.freewisdom.org/projects/python-markdown/Tickets/000087>in Python-Markdown. >>> import markdown >>> md = markdown.Markdown() >>> md.convert('Added `>>> ` to signify user input.') u'<p>Added <code>>>></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. I don't buy the argument that since default browser behaviour is to ignore this space, the space is insignificant and can be omitted from the markup generated. This is akin to arguing that lossy compression of audio files is fine since default (i.e. iPod/iPhone) headphones are of low quality and make it impossible to detect the difference between compressed and uncompressed versions.>From a practical standpoint, it should be possible to apply styling to thismarkup to drastically change its appearance. One could, for example, apply `color` and `background-color` styles to invert the code's colours. In conjunction with certain `white-space` values this could lead to the following: Added >>> to signify user input. Given the current implementations, information which is in this case significant has been lost by the time I get my hands on it. *How do others feel about updating what is considered to be the correct behaviour here?* Such a change would be backwards compatible since, as mentioned, default browser behaviour is to ignore such spaces anyway. In those rare cases where styling has been applied in order to make this whitespace significant, the change is a reflection of the output's (improved) fidelity. David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20110213/ec64dd41/attachment.htm>
David Parsons
2011-Feb-13 19:50 UTC
Should leading and trailing spaces between backticks be preserved?
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>>>></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