Unformatted Code Detector

As many of you are aware, use of code blocks when posting code or tool output to the forum is very important. The reason is that random parts of the text are often recognized by the forum software as markup, resulting in it being rendered oddly or incorrectly.

It is common for new forum users to miss this requirement, which results in helpers spending time on boring administrative efforts instead of the sharing of knowledge we come here for. Previous efforts to mitigate the problem through documentation have not solved it.

We have a new tool to automatically encourage the proper posting of code with Discourse's "Unformatted Code Detector", which is running on the Arduino Forum as of now.


The post workflow now goes like this:

unformatted-code-detector


You can see a demo in this screencast:


screencast


I spent some time playing around with it and was pleased with the experience. I believe this will be beneficial for our forum. The feature is enabled on private messages as well, so you can send messages to yourself to run it through its paces.


Some important points:

  • People who are already correctly formatting their posts should not be affected in any way by this change.
  • In the event of a false positive, the user always has the option of clicking the Post Anyway button to post the text as is.
  • The Edit Post button does not automatically add the code blocks. It only takes the user back to the post composer, where they can add it manually (e.g., using the </> button).

Please reply in this topic if you discover any problems with the new "Unformatted Code Detector" feature, or have any concerns.

7 Likes

Serial.println(("Thank you"));

(edit: was not recognized ...)

Haha. Not such an impressive first impression from the plugin I guess. My experiments indicate that this particular code is not detected by the plugin.

But there is another thing I just noticed. The plugin's disable at trust level setting is configured so that it is disabled for those at trust level 3 or higher. So forum "regulars" such as yourself won't be able to try it out here. I'll update the post with that info. There is a demo on the "Discourse Theme Creator" sandbox forum though:

1 Like

Thanks for the link, and getting it turned on, of course !

Why is it disabled for TL3 and above ?

1 Like

I think it was the default setting. I believe the plugin was customized a little bit for the Arduino Forum by the Discourse staff when they installed it, so you'll see some slight differences in the text if you try the demo I linked to above, but I haven't messed with the configuration at all.

I would hope that anyone reaching Trust Level 3 would be in the habit of posting their code correctly, so enabling it for them would not likely result in any increase in post quality, while at the same time potentially annoying them with false positives (hopefully not many though). But it is unfortunate that the feature is not available to the forum members who are most likely to be interested in testing it.

I'm going to temporarily change the setting so that everyone can experiment with it. Then in a couple weeks I'll put it back to being disabled for TL3 users.

Sounds like a good idea

Can you also turn on the automatic code generation and schematic drawing features ?

:wink:

4 Likes
void loop() {
Serial.print("Error, no error found");
}

EDIT
That worked!

2 Likes

that's cool !

1 Like

I am not sure how well it is working because I have seen 2 instances today of code posted without code tags, so either the detector failed to pick them up or the user decided to ignore the pop-up, which I can quite believe

I keep seeing some too, I would not be surprised the hint is just disregarded.

May be we should ask the question to newbies if they got the popup and why they did not fix their post

3 Likes

Thank you for implementing this. It is a feature I requested about 10 years ago and I was told it was not necessary. Glad to see some one changed their mind.

Oh!

And then refrain from any further responses until one of those questions is answered.

3 Likes

What about a locked until formatted status?
Probably a dumb idea on my part but just throwing it out there anyway.

3 Likes

yeah, I'd be in favour - although some other members might feel this is overkill and offer an answer anyway.

You are never going to get all users to cooperate in not replying until the OP has answered the questions and in any case the pop-up has a "Never ask again" checkbox and they could say that they were not warned about unformatted code

Agreed - it's personal choice to answer as it is to ignore a thread. I'll give it a try to see what answers we can get

totally love that idea!

I've just made an exemplarary post, at least in respect of all code blocks being enclosed in groups of 3 back tick characters. I still got the message: