+++ mathias [Mar 12 15 09:12 ]:
I suppose that removing leading and trailing spaces does make sense
This depends on the context. When I type a trailing space in an inline
code block (example of that — search for “note the space character
at the end”), it’s there for a reason, and I don’t want my Markdown
parser to remove it.
Please don’t collapse or trim spaces.
A leading and trailing space have to be removed, because of
the way Markdown inline code quoting works. Suppose you
want to quote a single backtick character. Then you do it
`` ` ``
Note, you have to leave a space between the opening sequence
of backticks and the contents, and between the contents and
the closing sequence, or you just get
which is nothing.
That's the motivation for stripping leading and trailing
backspace. The spaces in the example above are not part of
One possibility that would allow for leading/trailing
space in the content would be to strip at most *one*
leading or trailing space.
Indeed, that is suggested by Gruber's Markdown documentation,
> The backtick delimiters surrounding a code span may include spaces
> — one after the opening, one before the closing. This allows you
> to place literal backtick characters at the beginning or end of a
> code span.
However, his implementation, Markdown.pl, strips ALL the leading
and trailing whitespace.