trailing spaces in code block

John MacFarlane jgm at
Wed Jun 14 18:12:51 EDT 2006

It seems that Markdown 1.0.1 strips off trailing spaces at the end of
code blocks. Is this really what it's supposed to do? There might be
reasons to include trailing spaces in code displayed on a web page --
for example, in demonstrating how to do a hard line break in markdown.
Even if the trailing spaces aren't visible, they can be cut and
pasted. Besides, Markdown 1.0.1 preserves trailing spaces on
every line except the last line of a code block. Is there a reason
to treat the last line differently?

The reason I ask is that I've written an implementation of markdown in
haskell. It passes all of the tests in the test suite except "Markdown
Documentation - Syntax.text", which it fails because it retains the
trailing spaces in the code block at line 572. I could of course change
it to remove trailing spaces in code blocks, but if this is a bug and
not a feature, I'd rather see the test suite changed. Any thoughts?


More information about the Markdown-Discuss mailing list