# False positive? I get this error but cannot find any reason: “Your post appears to contain code that is not properly formatted as code.”

Editor's note since this is gathering close votes: the code formatting filter is not a Stack Overflow-only feature; it's active on four sites and a CM has stated that questions about it are on-topic here.

EDIT: This seems to be a bug. See my answer below for explanations.

I was trying to post a question to StackOverflow but I keep getting this error 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.

Unfortunately, no useful information is provided (no line-number for the error, etc.)

It took me quite some time to get the formatting right. Now it looks nice, everything seems properly formatted. I have no clue, why I get the error ... :(

I read half a dozen meta threads dealing with the same error, but none of the troubleshooting suggestions work for me.

Below the horizontal line is my text.
You can also see the unformatted source text here:
https://paste.ofcode.org/PntBVXpCTLkSt8Vz265Yb8

Strangely enough, the same text IS accepted here on meta without any error.

I am very grateful for any help.
It would be especially useful if you knew a troubleshooting method for narrowing down the location of the problem.

Hello. Can you help me with my first greasemonkey script? I'm a complete beginner and would be ingenuously thankful for help. I've tried a lot, but always fail.

My text looks quite long, but that's just because I am over-explaining for clarity sake. In truth, the matter is quite simple and I'd think a couple of code lines would suffice.

► In short, I'd like to catch the byline from an Austrian newspaper ("Kurier") article and add it (slightly modified) to the article's print view.

So here is what the greasemonkey script should do (without external scripts such as jquery):

• step 1: upon navigating to an article URL, redirect to the printview URL
• step 2: copy the byline from the article URL
• step 3: modify the byline (see below)
• step 4: paste the byline into the printview page

[step 1]
The print view of each article is located at [article URL] + "/print", for example:

This is the only step, I was able to do successfully myself (lol):

// ==UserScript==
// @name        KURIER printview
// @include     https://kurier.at/*
// @exclude     https://kurier.at/*/print
// @version     1
// @run-at      document-start
// ==/UserScript==

window.location.replace(window.location + "/print");


I used @exclude to avoid an infinite loop.

To not slow down the script, it would be great if @run-at document-start could be left unchanged, so that the script does not have to render the article page but directly jumps to the printview URL. Hence only 1 page has to be rendered instead of 2 pages.

(My hope being that step 2 can be accomplished from the printview location?
Otherwise can step 2 be accomplished from the article page, but without rendering the article page?
Either method would avoid rendering 2 pages.)

[step 2]
The byline is a div container, which comes in one of 3 different forms (depending on the number of authors):
• no author: <div class="misc no-author">
• single author: <div class="misc single-author has-image">
• multiple authors: <div class="misc multiple-authors">

Here are example articles for each type:

[step 3]
The byline div container has this structure:

<div class="misc [no-author/single-author/multiple-authors]">
|__ [optional content]
|__ <div class="last-modified">
|__ <div class="social-media-container">
|__ <div class="clear">


a) The social media container should be removed.
b) The optional content may include an image.
The image URL scheme is: images.kurier.at/[imagename].jpg/[size]x[size]/[imageID]
If an image is present, the pixel values should be changed from:

<img width="35" height="35" src="https://images.kurier.at/Sandra-
Lumetsberger(2)-REdit.jpg/70x70/133.396.913" alt="Sandra Lumetsberger">


to:

<img width="100" height="100" src="https://images.kurier.at/Sandra-
Lumetsberger(2)-REdit.jpg/200x200/133.396.913" alt="Sandra Lumetsberger">


[step 4]
The printview page has this structure:

<body>
|__ <script>
|__ <div class="wrapper">
|__ <div class="rfloat noprint">
|__ <p class="open12 marginb10">
|__ <div class="clear">
|__ <article>


The byline div copied in step 2 and modified in step 3 should be pasted below the p element.

Thank you so very much!

• Wild, untested guess: that bullet-list with <div>s in it is throwing the code-detector off. – Shog9 Apr 17 '17 at 23:19
• @Shog9 : thanks, but how can I test what the problem is ? If I remove formatting and then the posting gets through, I lost the formatting :-( – summerrain Apr 18 '17 at 0:06
• "Strangely enough, the very same text IS accepted here on meta without any error." This isn't strange once you know that Meta doesn't have the code check enabled. – Laurel Apr 18 '17 at 2:12
• @Laurel : oh, ok. I got other formatting errors here on meta, which led me to assume the rules/requirements would be the same. My bad. – summerrain Apr 18 '17 at 13:35
• To close voters: the code formatting filter is not a Stack Overflow-only feature; it's active on four sites and a CM has stated that questions about it are on-topic here. – Sonic the Masked Werehog May 13 '19 at 6:12

So, here's how I debug these:

1. Get the error to appear. This is easy for me, since we log the full text for each error. It's even easier for you, since you already have the editor open with the error visible.

2. Binary search: Cut out half of the post, see if the error goes away. If it does, restore the full post and cut out half of what you previously removed; if it doesn't, cut out half of what remains. Repeat until you've narrowed down the source of the problem.

Using this method, I identified this paragraph as the trigger here:

• no author: https://kurier.at/wissen/mars-experiment-auf-hawaii/218.311.221
• single author: https://kurier.at/wissen/mars-simulation-auf-hawaii/249.106.702
• multiple authors: https://kurier.at/wissen/mars-wann-ist-es-soweit/230.174.316


That's not a bullet list - it's three lines, each starting with • - the bullet character; for once, Unicode is not the culprit here; rather, the fact that the list wasn't actually formatted as a list caused the code-checker to observe the structure and assume that it was code rather than prose. Formatting it as a list fixes the issue:

Here are example articles for each type:

- no author: https://kurier.at/wissen/mars-experiment-auf-hawaii/218.311.221
- single author: https://kurier.at/wissen/mars-simulation-auf-hawaii/249.106.702
- multiple authors: https://kurier.at/wissen/mars-wann-ist-es-soweit/230.174.316


This renders almost identically, but since the Markdown formatting causes the structure to appear intentional rather than accidental, the code-checker doesn't freak out about it. Using this same technique would also be appropriate for the other lists in the question.

• Thank you so much for your help! Funny enough, I simultaneously came up with the very same idea ... (see my answer above/below). So yes, that's exactly how I weeded out my text and I also identified the section with these 3 links as the culprit. However, I removed everything, including the fake bullet points (which BTW I used on purpose because the real bullet points have too much line spacing) and the text preceding the links. So I really only kept the 3 links (followed by 2 whitespaces for linebreak). That's all. But I still get the error ... although this clearly should not happen! – summerrain Apr 18 '17 at 0:51
• Try the list formatting I include here - as I said, I suspect it is the format that's triggering this. – Shog9 Apr 18 '17 at 3:03
• It seems to be a bug. See meta.stackexchange.com/a/294842 (particularly the conclusions in the edit at the bottom). – summerrain Apr 18 '17 at 13:37

I managed to track down the section, which causes the problem:

Here are example articles for each type:


For testing purposes, I removed EVERYTHING and only kept the 3 links (without any formatting):

... and the error still appears.
So for some reason, these 3 links trigger the error message.

It appears to be a bug.

EDIT: After further testing and with the kind help of @Shog9 I now come to the following conclusion:

• The 3 links CAN be posted as a true bullet point list.
• The 3 links CAN be posted as a fake bullet point list with "-" as list formatting character.
• The 3 links CANNOT be posted as a fake bullet point list with other list characters, such as "•".
• The 3 links CANNOT be posted WITHOUT a list (i.e. just the links with or without preceding text).

While the first conclusions is expected (and arguably also the second and third one), the fourth conclusion clearly is not. This seems to be a bug.

I don't know where to file bugs. Maybe someone can draw the developpers' attention to this problem.