Warning or confirmation when posting help without a code block?

Is it possible to have a warning/confirmation dialog when a user tries to create a help topic without a code block?

I find that a lot of the time people are ignoring the pinned post and giving either screenshots or code in text. Maybe if we had something reminding them and specifically saying something like: “We don’t see a code block in your post, is your code properly formatted as shown in linktopinnedthread.” If they say yes, then post as is, if no, send them back to the editor to add a code block.

I get code blocks aren’t needed in all cases, but I think it’s a reasonable litmus test to remind folks to post proper code snips.

AFAIK, we’d have to write our own custom Discourse plugin—I don’t think there’s any built-in way to provide that sort of functionality, and I doubt (though it isn’t impossible) that an existing plugin exists for that very specific case.

If it did exist, do we think it would be a positive change?

I mean, I don’t think it would hurt, but realistically the main way Discourse would display that sort of info would be in a warning on the right preview panel, and if users are already ignoring the pinned post, other guidance and the preview in general (seeing how many evidently don’t bother to spend even a moment verifying that their code, etc. displays correctly), I’m not it would be enough of a help to merit the effort required to develop a plugin. But if one did exist that would allow us to do that, IMO it might be worth considering (though perhaps the number of people posting questions that don’t need a code block is probably greater than the number who aren’t, should and would actually pay attention to such a warning).

1 Like

There is this discussion on the meta discourse: https://meta.discourse.org/t/catch-and-educate-users-posting-code-without-properly-formatting-it/67958, but I am not actually sure if that discussion lead to anything that the admins could simply add here.

1 Like

Yeah, for that we enabled the unformatted code detector; My understanding was that the OP is requesting something broader, a warning for all Python Help posts missing a code block, including those with screenshotted code, those that don’t even attempt to provide the relevant code (unfortunately very common), as well as those the unformatted code detector misses.

1 Like