15

tl;dr This is a feature request to enable automatically detecting unformatted code in first-time posts, and show a helpful message to the poster on how to fix it.


According to the following meta post, StackOverflow automatically detects posts which have a lot of unformatted code and blocks them until they are fixed:

This feature is active for posters with less than 50 reputation, and will show guidance on how to create code blocks:

Oops! Your question couldn't be submitted because:

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 tested if this feature is active on Mathematica.SE. It isn't. Can we have it enabled please?

I tested this by posting the following through an unregistered account: https://mathematica.stackexchange.com/q/130706/12. By the time you read this, it will probably already be deleted, so here's a screenshot:

Post with unformatted code

I did not receive any warning, or notification that the post requires formatting. It went through immediately.

It is my impression that on our site a high fraction of first-time posts (even majority?) lack any formatting. I did a quick check of the last 10 or so first-time posts to verify that this impression is accurate—I am certain it is. This creates a bad experience for everyone—both first-time posters and those higher rep users who fix these posts. It also results in a lot of wasted time.

Feature request: Can we please have this feature enable on Mathematica.SE?

  • 2
    I imagine it would have to be customised for this specific SE, or does it block badly formatted mma code on SO too? – Feyre Nov 8 '16 at 14:34
  • 1
    @Feyre It could be that the feature is already enabled here but doesn't work well with Mathematica code. I don't know. Only someone from SE could tell us. I didn't want to create too many unnecessary posts on different sites to test this—the one I made here is plenty. If there's problem with feasibility, I expected that they will tell us. But I trust that it will be possible—follow the links within my first link to see how code detection might work. – Szabolcs Nov 8 '16 at 14:41
  • 3
    I disagree, I think the barrier for asking a question should be pretty low. New users are already struggling with learning the syntax of W|L, and demanding that they also be able to use markdown is a bit much. Also, there are plenty of users here who will either ask them to reformat their code or edit it for them (isn't there some badge associated with editing?). – Jason B. Nov 8 '16 at 15:00
  • 1
    @JasonB I looked at the page that first time posters see. There is a lot of very clear always-visible formatting help and the toolbar is labelled with words (not just icons). The entry barrier is already very low: it doesn't even require registration. This feature doesn't prevent people from posting. On the contrary: it helps them post a reasonably readable question by explaining clearly what is wrong with their original attempt. – Szabolcs Nov 8 '16 at 15:12
  • @JasonB If after getting so many pointers someone still isn't able to or isn't willing to format their post, then very likely they won't be able to contribute much, if anything here. I see no disadvantage to blocking in that case. Letting these posts through without even this much vetting has many disadvantages: drain on the community, higher risk of burnout for people who would otherwise be helpful, a worse image of the front page (which will have more junk on it), etc. – Szabolcs Nov 8 '16 at 15:13
  • 6
    @JasonB I think that someone that's trying to solve an ODE or one that has enough chops to use an answer from this site probably also has the mental capacity to learn markdown. I'm generally in favor of getting low quality stuff out at its lowest value stage and that is at the time of submission. Letting the software deal with this allows us to focus our time and efforts towards the other aspects of community building rather than regurgitating a "please format your post" comment. Besides, by letting the software do it we can absolve ourselves of the "bad UX" while remaining welcoming ;) – rm -rf Nov 8 '16 at 15:45
  • @JasonB If you feel strongly about it, post an answer and explain your point in detail. Say, "vote here if you don't want this feature enabled" at the top. I'll post another one then and argue why it should be enabled. I do agree with your that the entry barrier should be low, but I don't think this feature will raise it much. I also agree with what you seemed to imply, that M.SE should be friendly and helpful. But I think that this feature will help in keeping it friendly in helpful and that without this feature the friendliness will deteriorate further. – Szabolcs Nov 8 '16 at 16:21
  • 1
    @Szabolcs - I considered adding as an answer, but I don't like getting downvotes even on meta :-D I sometimes have trouble with the philosophy of SE, and moderated forums in general. The anarchist in me rejects it, but philosophically SE values "quality questions" that should stand the test of time. I don't really feel strongly about this, just felt like throwing my dissenting opinion out there – Jason B. Nov 8 '16 at 18:33
20

I've enabled this for users with <= 200 reputation.

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.

...That said, don't expect too much. This will correctly detect large code dumps, but won't necessarily detect single-line expressions interspersed with prose as in your example.

I've also enabled a check that enforces a code to non-code ratio (currently 4 characters non-code to each line of code, same as on Stack Overflow).

You must log in to answer this question.

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