It seems like a very high percentage of newbie posts don’t format their code properly, leading to all sorts of weird formatting errors, lots of first replies being “I can’t answer until your code is readable”, and lots of mods having to go back and help people add in backticks.
Seems to me like the best way around this would be automatically detecting when a post has code that isn’t enclosed in backticks and warning the user.
It wouldn’t necessarily catch all languages (the most common ones in freeCodeCamp could) because they’re so many of them, but it would be beneficial. If I recall correctly this forum is run on Discourse though a plugin to do this may be possible. Maybe it could be an open source plugin for any Discourse forum to run
Modified the regexes/conditional to account for this.
That’s a great idea! Unfortunately, looking at info I can find on creating Discourse plugins, it seems like the threshold is pretty high (this “beginner’s guide”, for example, starts by recommending you read another guide that tells you how to set up the environment, which itself looks to be a fairly extensive process).
Serendipitously enough, I learned Ember recently for unrelated reasons, and Discourse now has “theme components” as a lightweight, front-end only alternative to plugins, so I hacked something together. @QuincyLarson@raisedadead any chance we could get this added to the forum?
@lionel-rowe this may/may not be a good idea, and I haven’t looked at how this works, but would it be possible to target the code block button in the text box when that dialog is closed so that it could be highlighted, eg add click handler to confirm button -> onclick add inline style to code button that changes its colour to something obvious then transitions out after a second or so
I think it would be doable, though I’m not sure how easy without resorting to hacky document.querySelector stuff (which is definitely not “the Ember way”, haha). The other thing is that the message would need to change, as currently it only mentions the `backtick` method.