14

On four sites in the network, there is a code formatting filter that checks for users pasting in code but not formatting it correctly. When it is triggered, it says the following:

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 button.

There are a couple problems with this message, as is:

  • The "[?]" button referred to in the message no longer exists - the button now instead has a text name, "Show formatting tips".

  • Four-space indent is no longer the preferred way to format code by hand, as the code formatting help (referred to in the above button) no longer lists it, instead listing the code fence (```) method. This method is also easier for users, as they don't have to indent every line.

Additionally, it doesn't indicate what to do in case of a false positive indication - across this site, there are several people asking about cases where they didn't enter any code but the filter still doesn't let them submit their post. (It's not a warning - it blocks submission entirely if it's hit.) In many of those cases, it is indeed a valid false positive: there were a few cases where the thing being mistakenly recognized as code was actually valid Markdown, and one recent case where it was recognizing valid MathJax as code (in this last case, fixing it isn't as simple as changing the Markdown style: the MathJax is fundamental to the post).

Can we please fix the code filter error message so the above two problems are resolved, and so it indicates what to do in case the user posting the question believes the message to be incorrect?

0

You must log in to answer this question.

Browse other questions tagged .