I have done both of these. Here's why they happened to me.
Code blocks
- Type / paste in the code.
- Oh, it's not formatted.
- Move the cursor to the start of the first line.
- Hold Shift.
- Hold Down.
- Click “Code Sample
<pre><code>
Ctrl+K”.
- Post.
Clicking the “Code Sample” button will indent all lines containing selected text. If you've placed the cursor at the very beginning of the first line, you will end up not selecting any of the last line, and that last line will not be included in the four-spaces-indented block.
Image links
- Upload image.
- Post.
New users don't have the privileges to post an image, so it gets automatically converted into a hyperlink by the Stack Exchange software. (And if SmokeDetector is anything to go by, you should be thankful that the system behaves this way!)
Related phenomena and speculations
Consider a fictional question:
Hello, I have a problem with this code :
#include "stdout.h"
int main () {
printf("Hello world");
}
It works but there is a warning that I dont understand:
helloWorld.c:3: warning: implicit declaration of function 'printf'
Inline code paragraphs
This can be explained by a user doing the following:
- Type / paste in the first line of code.
- Oh, it's not formatted.
- Select the first line, and click on the formatting button at the top.
- Deduce how the formatting works, adding backticks and paragraph breaks as appropriate.
or:
- Type the start of the question.
- Click on the code icon, to change it to a code font, without first pressing Enter.
- See
`enter code here`
.
- Paste in the code, breaking the formatting.
- Deduce how the formatting works, adding backticks and paragraph breaks as appropriate to fix it.
Unformatted error message
The error message is not in a code block. This is because it is not code; it is an error message. (The asker hasn't noticed that error messages often contain ASCII art, and hasn't realised that errors should always be posted in monospace.)
[!
and trailing][1]
around it to make it display like this. How come new users all do this so consistently.Ctrl+K
add triple backticks instead of indent? I remember when I wrote my first post, I foundCtrl+K
quite confusing to use and I didn't know triple backticks was a thing becauseCtrl+K
(and also pressing the{}
button) leaded me straight to indentation.{}
code formatting button that works similar to a WYSIWYG word processor. You just have to care enough to not crap on the lawn of the people you're asking for help, i.e. review your question and maybe take a couple minutes to figure out the editor. I have near-zero sympathy for people with boring questions who have that little respect for the people who's attention they're taking. I can see not noticing a stray}
after doing what you describe in your answer, but fubared ugly indenting or total lack of code format is just rude.