When you write a post, you can press "code sample" button on empty line. This causes the following output to appear.
Code:
enter code here
Result:enter code here
Well, you may think it works as intended. Well, let's write a small program, like the following.
#include <stdio.h>
int main(void) {
puts("Hello, world!");
return 0;
}
Sounds rather easy, press "code sample" and start typing, or paste from text editor. Well, it's not quite that simple.
Code:
#include <stdio.h> int main(void) { puts("Hello, world!"); return 0; }
Result:#include <stdio.h>
int main(void) { puts("Hello, world!"); return 0; }
The issue is that only the first line of code is intended, when Markdown requires entire code to be indented.
Almost nobody uses "code sample" button to post a single line of code. And yet, this is the only thing that works when pressing this button on new line without selecting any code. This is unlikely what the user intended. I quite often see this mistake on Stack Overflow, from low reputation users.
My suggestion to fix this issue is to either allow GitHub Flavored Markdown syntax (with ```
) or use more clever post editor, which automatically indents Markdown when pasting or pressing Enter.