Forum: catching badly formatted code posts

One major complaint for regulars on the old forum was the constant need to write back to new users and explain to them how to format their code. Regular responders wrote “please format your code” or shared links to the FAQ “How to format your code” roughly 4000 times in the past few years.

It might be nice to keep our eye on this conversation about a bad-code catching plugin for Discourse, possibly modeled on StackOverflow:

3 Likes

It would be very cool to detect this automatically.

Another thing that may help is adjusting the welcome message to make it less likely that the code gets shared unformatted.

In the openFrameworks forum I think the message looks like this:


Hi! Welcome to %{site_name} — thanks for starting a new conversation!

To get help faster:

  1. Think of a useful title. Describe the issue in one sentence. Avoid common words like “problem” or “help”.
  2. Describe what you are trying to do.
  3. Describe what goes wrong.
  4. Include code and format it. Paste your code, select it and press the </> button in the toolbar to make it beautiful :slight_smile:
  5. Include a screenshot? Worth 1000 words sometimes.

This message will only appear for your first %{education_posts_text}!


The average user in both communities may differ and the message may need to be adjusted. But in general the idea is to make it easier to ask questions that are easier to answer and are more useful for others.

Here the source:

Hi! Welcome to %{site_name} — thanks for starting a new conversation!

To **get help faster**:

1. Think of a _useful title_. Describe the issue in one sentence. Avoid common words like "problem" or "help".
2. Describe _what you are trying to do_.
3. Describe _what goes wrong_.
4. Include _code_ and _format_ it. Paste your code, select it and press the </> button in the toolbar to make it beautiful :) 
5. Include a _screenshot_? Worth 1000 words sometimes.

This message will only appear for your first %{education_posts_text}!
3 Likes

I agree we should edit the just-in-time message shown to users. One tiny thing: I’d go with bold instead of italics in the text. I’d couple this with links that explain more. Something like:

Include code in the form of an MCVE and format it. See here for more info.

1 Like

Great suggestions on the welcome message. I think looking at that might require an admin-level account – @fjenett

1 Like

Is it wise to encourage screenshots this way? I mean, at least it could be mentioned not to screenshot error messages but to paste them directly in the forum. Also, is it possible to add, beside bold, color text in the forum?

Kf

2 Likes

4 posts were split to a new topic: Enabling Colored Text

Hey, thanks for the suggestions. Will look into it this weekend.

1 Like

2 posts were split to a new topic: Preventing Users from Deleting Topics

An unformatted code detection plugin still has never materialized, but the conversation continued. Somebody on the Discourse forums created a Clippy The Paperclip that follows around a user who is flagged for unformatted code. That wouldn’t work here, but it is funny.

2 Likes

That is awesome!
:grinning:

1 Like

That would definitely be a cool feature! But I don’t think there should be a penalty for bad formatting. We don’t want this site to be very restrictive to new users