The Markdown filter test fails with Discount 2.1.0 because of newline differences.
Since it is difficult (and not functionally interesting) to try to reconcile the newline differences across different Markdown engines, I suggest to make the test newline-invariant.
Below is the failing test.
filters.test.js test :markdown filter: AssertionError: "<h1>foo</h1>\n\n<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n" == "<h1>foo</h1>\n\n<ul><li>bar</li><li>baz</li></ul>"
at next (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:769:25)
at runSuite (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:787:6)
at check (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:648:16)
at runFile (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:652:10)
at Array.forEach (native)
at runFiles (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:629:13)
at run (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:598:5)
at Object.<anonymous> (/Users/ruben/Library/Tools/node/lib/node/.npm/expresso/0.6.4/package/bin/expresso:851:13)
at Module._compile (module.js:423:26)
Markdown filter test now functions newline-invariant.
Corrected test :markdown filter with preformatted code.
Another problem is that markdown code blocks newlines are broken.
Note the extra newline above the closing bracket. Since this is a pre block, this extra newline will show up in the output.
The problem is that Jade surrounds each indentation block by newlines. Since the second x starts a new indentation level, two newlines are written (one for each x).
The solution I'm proposing (which is far from ideal) is a distinct "filter" lexer mode in which filter contents are respected literally, and where a succession of outdents is interpreted as one large outdent. See current implementation, which passes all tests.
I also saw it's not just a problem of the Markdown filter; it also occurs when I try to add the same piece of code right into Jade code.
This issue has been inactive for over 2 months so I'm closing it. If you think it's still an issue re-open. - tjbot