I am trying to post a question to Stack Overflow (and also relevant on a few other sites) but am met with the following message:

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.

I'm not entirely sure why given that I've followed the formatting where I believe it is required. My question is formatted as follows:

I would like to {do something with this data}:

Country Year LifeExp GDP
Chile 2000 77.3 7.79e+10
Chile 2000 77.3 7.79e+10
Chile 2000 77.3 7.79e+10
... ... ... ...
Zimbabwe 2013 58.0 1.55e+10
Zimbabwe 2014 59.2 1.59e+10
Zimbabwe 2015 60.7 1.63e+10

Ideally, I would like to {do more stuff with this data}.

gdp_data['GDP%'] = 0
gdp_country = gdp_data[gdp_data['Country'] == 'Chile']
gdp_data['GDP%'] = gdp_country['GDP'].pct_change()

Is there a (correct and) more efficient way?

  • 6
    The most likely cause is that the Markdown table is being recognized as code. Chances are that the code detector hasn't been updated since support for tables was added to the system, and that the developers overlooked doing so since higher-reputation users are exempt from the filter and it's not enabled at all on all but four sites in the network. Commented Mar 1, 2023 at 13:04
  • 2
    Also, to the close voter who voted this as "site-specific" - the code filter is enabled on four sites, not only Stack Overflow. Take another look at the usage guidance for the close reason in the dialog. Commented Mar 1, 2023 at 13:12
  • Thank you @SonictheAnonymousHedgehog. Do you know if this issue will be fixed?
    – tmrgn
    Commented Mar 1, 2023 at 13:30
  • 2
    @Sonic just a thought, it might be worth documenting which sites in e.g. the FAQ? (I don't know which ones ...)
    – Glorfindel Mod
    Commented Mar 1, 2023 at 14:26
  • 4
    @Glorfindel: The relevant Q&A: What sites have the code formatting filter enabled?
    – V2Blast
    Commented Mar 1, 2023 at 15:23
  • 2
    Voting to leave open based on Sonic's comment. If someone's confident the cause of the problem is the table consider retagging this as bug.
    – bad_coder
    Commented Mar 1, 2023 at 17:17
  • @bad_coder not 100% confident, but I can remember 2 other situations where a table seems to have caused this issue (one a question on meta, and the other my own question iirc)
    – Esther
    Commented Mar 1, 2023 at 21:23
  • @bad_coder meta.stackexchange.com/questions/378308/… another question where tables were triggering an improperly formatted code error
    – Esther
    Commented Mar 1, 2023 at 22:27
  • It would be great if you would include the exact Markdown that triggered the error. I copied the Markdown from meta.stackexchange.com/posts/387101/edit I then went to stackoverflow.com/questions/ask and pasted the Markdown unchanged. Upon pressing Review your question, I got Your question is ready to publish! Conclusion: I couldn't reproduce the error message you reported here. Commented Mar 4, 2023 at 17:41
  • @Henke I was able to post the question later in the day with zero changes made to the content. Hence, I'm not sure why the error was thrown at the time. I'm sorry I can't be of more help in reproducing it.
    – tmrgn
    Commented Mar 7, 2023 at 13:49
  • Thanks for responding! Theoretically, the reason could be that "someone" corrected a bug in the filter. But since you couldn't reproduce the bug later the same day, that doesn't seem very plausible. The only plausible explanation I can see is that this bug occurs with some randomness. If so, you must have had some bad luck when trying to post the first time. Someone with a sense of responsibility should definitely do some serious work to correct this buggy and crappy "feature"! Sigh. Commented Mar 7, 2023 at 13:58


You must log in to answer this question.

Browse other questions tagged .