53

I tried changing every section in the code below (using/not using four character indentation with/without pre). I also tried removing the formatting and the line separators on the list.

Nothing helps - after each try I get:

Error Message - on www.diigo.com

The Stack Overflow code:

Stack Overflow code

15
  • 8
    Indent your code with 4 spaces will probably help instead of <pre>. Also you don't need to use <p> and <br>, just use a blank line Commented Mar 29, 2014 at 11:12
  • 6
    Don't use <pre>; select your code (all lines) and use the {} button to have the editor indent it with 4 spaces. Commented Mar 29, 2014 at 11:13
  • 27
    You don't have to use any HTML; two newlines creates a new paragraph (don't use <p>); two spaces at the end of a line creates a line break (don't use <br>). By using HTML for markup you also trigger the 'there appears to be unformatted code' error. Commented Mar 29, 2014 at 11:17
  • 1
    sometimes it need 8 spaces instead of 4 to render the code properly drupal.meta.stackexchange.com/questions/2882/…
    – Bala
    Commented Mar 29, 2014 at 11:18
  • 3
    Thanks John and Martijn for the quick suggestions: using select+<ctrl-k> did indeed solve the problem.
    – user1656850
    Commented Mar 29, 2014 at 11:22
  • 7
    Keep in mind that no-one can test what the rendered version of your question will look like if you just post an image of the text. To address this, please post the actual text, marked as code (i.e. indented with 4 spaces) instead. Commented Mar 29, 2014 at 11:23
  • Thanks Martijn for the tip on new line/para: I don't remember seeing it in the markdown help screens...
    – user1656850
    Commented Mar 29, 2014 at 11:25
  • @Dukeling That was my first try here, but I tried pre instead of the ident (had I known the correct usage of the ident, there would not be a reson for the above question ;-)
    – user1656850
    Commented Mar 29, 2014 at 11:28
  • @user1656850 Just keep in mind the possible problems with posting text as images for future posts. Commented Mar 29, 2014 at 11:43
  • Just wondering: did you click that [?] toolbar icon as prompted in the error message, and if so: what needs to be improved there?
    – Arjan
    Commented Mar 29, 2014 at 14:05
  • @Arjan Yes, and I entered the 4 spaces suggested there manually (in vi). However, seems SO didn't like that, but did like when this ident is entered using <CTRL-K>
    – user1656850
    Commented Mar 29, 2014 at 14:26
  • 10
    Four spaces isn't entirely sufficient. You need a blank line before the first indented line.
    – mhlester
    Commented Mar 29, 2014 at 17:18
  • 2
    problem is in THE FORMATTING TOOL and that has been there for a long time
    – 10101010
    Commented Apr 4, 2019 at 15:56
  • The www.diigo.com link is broken (404). Commented Sep 21, 2020 at 14:27
  • 1
    Trouble formatting code (besides the obvious) comes up on a regular basis and in general (perfectly formatted posts with text and code not accepted). Perhaps promote this to the FAQ/canonical? Commented Sep 21, 2020 at 15:43

14 Answers 14

42

Include pictures in post may cause this problem.

If we insert picture using Image button in toolbar, or use shortcut key Ctrl+G, a script like below will be inserted to out post:

[![enter image description here][1]][1]

This causes my question can't be posted with error Your post appears to contain code that is not properly formatted.

I fixed it by changing the picture script to:

![enter image description here][1]

Note: My post contains three pictures. Not sure if only certain number of pictures will cause this problem. But changing the picture script surely solved my problem.

5
  • 4
    I had the same problem even after removing the not needed outer brackets and stuff. Removing double spaces after the images solved it for me. Commented Apr 8, 2017 at 19:55
  • Worked for me. Many thanks for solution!
    – Denis
    Commented Oct 30, 2017 at 12:59
  • This problem really should be escalated. I'm going to send a link real quick to their support team. This wasted so much precious time... Commented Jun 27, 2018 at 6:16
  • It's hard to believe this has been an issue since at least March of last year. Why is the inserted code incorrect? Commented Jul 27, 2018 at 10:05
  • 2
    @AlistairCarscadden Mostly looks like a bug...
    – zhm
    Commented Aug 1, 2018 at 7:52
18

The following can help you to figure out where your post is broken, as the error dialog itself isn't helpful at all (line number, etc.?)

By marking the whole thing as

quote (Ctrl + Q or the button)

you sometimes can reveal the errors (by breaking your post).

If anything in the quote seems broken, that is an indicator to look for.

Don't forget to remove the quote again (Ctrl+Q) before posting it.


In my case, the quote still contained the correct code blocks, but the links were the cause.

Instead of the expected link:

description

They were displayed raw like the following:

[description][1]

The link reference was visible at the posts ending, too:

[1] : http://example.com

7
  • No, you should use ctrl+K for code and not use <pre> tags as the OP did. There is an help article as well about formatting
    – rene
    Commented Dec 27, 2015 at 22:36
  • 2
    That sometime just don't work. Commented Dec 27, 2015 at 22:36
  • 1
    Well, it would be interesting to know why that doesn't work. Advicing to make it a quote will only end in down votes from regulars due to the awkward formatting
    – rene
    Commented Dec 27, 2015 at 22:39
  • In case of my question here it did the trick. It broke all my links, but after fixing them, the post was how I wanted it. Sadly I can't find that changes in the history, to link them as example. Commented Dec 27, 2015 at 22:42
  • Point is: This might show you where exactly is something wrong, as the wrong stuff might break in the process. The error output isn't helpfull at all, and there is no "Trust me, I used code!" button. Commented Dec 27, 2015 at 22:45
  • 2
    My point is that your answer should be written such that it guides users how to fix their formatting, what things they should look for. At the moment you only give an nasty hack that might people get banned if their posts get negative attention due to your hack.
    – rene
    Commented Dec 27, 2015 at 22:50
  • Thank you thank you thank you!!!! I was able to fix my post. Also, I don't think that luckydonald is suggesting that you post your question as completely quoted, he's suggesting that by putting everything in quotes and observing what suddenly becomes broken, you're able to better find the issue and solve it, and then after you solve the problem you can undo the all quote and make it a normal post again. Commented Oct 26, 2020 at 19:30
7

I've the same error and after spending 2 hours the fix was I've some header and I need to add extra break line after the header.

0
6

I've tried editing an old answer and faced the same problem. The answer contained quoting, and used code in the quoted block. I spent almost an hour finding out that the first one below is invalid, and only the second one is accepted. Seems like first one was accepted at the time of the answer was written, but this is changed since then.

> Quoted code (invalid)

> 
     <?php
     echo "Hello world";
     ?>
> Quoted code (valid)

>     <?php
>     echo "Hello world";
>     ?>

However if you check them in the preview, they still produces the same:

Quoted code

<?php
echo "Hello world";
?>
5

I had the same problem, and thanks to luckydonald's answer, I used the trick to quote everything and see what's wrong. Indeed for me it was the links.

More precisely, I had a link [supported][php-eol], and that was causing the error. When I changed "php-eol" to "2", it worked. Don't know exactly what is causing that, but probably linked to having "php" as the start of the reference

0
4

It can also be code in tables. This caused my answer to be rejected:

|Mathematical Operation|JSBI Operation|
|---------|----|
|Addition|c = JSBI.add(a, b)|
|Subtraction|c = JSBI.subtract(a, b)|
|Multiplication|c = JSBI.multiply(a, b)|
|Division|c = JSBI.divide(a, b)|

which here on meta.stackoverflow.com renders as

Mathematical Operation JSBI Operation
Addition c = JSBI.add(a, b)
Subtraction c = JSBI.subtract(a, b)
Multiplication c = JSBI.multiply(a, b)
Division c = JSBI.divide(a, b)

What worked was enclosing the code portions in backticks:

|Mathematical Operation|JSBI Operation|
|---------|----|
|Addition|`c = JSBI.add(a, b)`|
|Subtraction|`c = JSBI.subtract(a, b)`|
|Multiplication|`c = JSBI.multiply(a, b)`|
|Division|`c = JSBI.divide(a, b)`|

which renders as

Mathematical Operation JSBI Operation
Addition c = JSBI.add(a, b)
Subtraction c = JSBI.subtract(a, b)
Multiplication c = JSBI.multiply(a, b)
Division c = JSBI.divide(a, b)

For context, the tables are about JSBI aka JavaScript BigInt operations.

4

Possible issues and their fixes are

  • Code formatting - use Ctrl + K to format the code.
  • Quoting issues - Make sure there is a space between the angle bracket > and the text being formatted.
  • Header issues - Put a newline between the header and the text below it.
  • Link issues - Put a newline after the link.
0
3

I had the same error message but the problem was a link with # like

www.example.com#about

Not the best answer but I solve it deleting the # and the div name.

1

I believe I have had the error because I was using metacharacters in the text of my post. Removing them worked for me.

1

In my case I encountered the error while using = in the normal text (non-code) section.

Enter image description here

The error was gone once I formatted those four lines as code.

-2

This error may occur because of bare URLs in the message text.

I had same issue, but when I added a description to the hyperlinks, the problem was solved. You can do this automatically by clicking on the "Hyperlink" button in the toolbar.

-2

For me, the issue was with quotes. I did not have any code.

But I did not leave any space between the > and the quoted text thus the error.

1
  • 2
    This is already covered by Minecraftchest1's answer. Commented Dec 28, 2023 at 20:00
-3

The easiest way is Ctrl + K after selecting the code with the mouse. The problem is getting solved.

3
  • Should hope it was solved since this post is six years old
    – charlietfl
    Commented Sep 20, 2020 at 17:28
  • I just wanted to help. It is okey
    – user11143033
    Commented Sep 21, 2020 at 9:39
  • @charlietfl: It comes up on a regular basis (e.g. last month). Commented Sep 21, 2020 at 15:52
-4

What an ugly error message, Stack Overflow!

And I cannot find the "[?] toolbar" anywhere on the page. Is there supposed to be some more information in that magic place? If so, it's lost on me!

BTW, 2 spaces are very beautiful to some!

And FWIW, the error was because of a column of a table had a timestamp in it ("2021-01-01 0:00:00")! Geez. (Facepalm.) Thanks @cachius for the tip (https://meta.stackoverflow.com/a/417195/2178774) to add backticks directly to certain table data (e.g. 2021-01-01 0:00:00 in this case).

2
  • 1
    There are many bad choices in the Markdown standard (notably significant trailing space), but 4 spaces indent is not one of them. Commented May 13, 2022 at 11:18
  • @PeterMortensen Unfortunately the error message appears to have nothing to do with spacing! It's resolved by adding backticks to the timestamp.
    – There
    Commented May 13, 2022 at 15:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .