Code tags don't support blank lines

Easy repro. This code should have two empty lines but doesn’t:

TestFunction() {

}

TestFunction()

Discourse syntax:

When posting code on a Discourse forum, it can get really messy without the whitespace included for readability. It supports tabs, spacing, and whatnot, but for some reason it doesn’t allow blank newlines. I’m not sure if this is unintended or not, but it’d be great if text in code tags allowed blank lines to preserve the original formatting. It should allow infinite blank lines as well: there really isn’t an issue of preventable spamming because someone could just put a single character on each line and achieve the same effect.

test() {



}

test()

I use <pre> your code </pre>

1 Like

You can use Markdown for code blocks.
http://commonmark.org/help/tutorial/07-code.html

4 Likes

Thanks @Trash @gerhard – I’ll use those then.

I assume the Discourse staff would still want to either fix or remove the code tags though since they do have an issue.