10

I noticed a lot of questions from new users don't use code formatting. I am not very active here, so my view might be skewed - has anyone tried to collect statistics how many revisions of questions are mostly about code formatting / other markdown syntax improvements?

Would it be useful to detect most common "mistakes" in markdown syntax and notify users about possible improvements before they post a question?

e.g.:

html code examples as plain text

example: <html>dd</html>

=>

example: `<html>dd</html>`

tabular data without leading 4 spaces (with multiple spaces or tab characters):

1   2   3
4   5   6

=>

    1   2   3
    4   5   6

missing empty line before code formatting

example:
    var j = "fff";

=>

example:

    var j = "fff";

Can you please point me to previous efforts in this direction or perhaps other efforts to improve the editor in different ways that would avoid this kind of markdown formatting problems?

Or else where can I start if I want to run some (SQL) query to select question revisions where `, a new line or 4 spaces at beginning of a line have been added?

Also I did not find any instructions how to contribute to https://code.google.com/archive/p/pagedown/wikis/PageDown.wiki if it is even possible...

10
  • I could be wrong but I thought a pop was already issued if a user pasted a bunch of code but does not have it marked up as code. This may be a new user feature only. Commented Jul 6, 2016 at 14:09
  • 2
    Such feature already exists. Whenever I paste a code, it always prompts me to format it. Not that I wouldn't do it anyway, but probably some users just ignore it - either on purpose, or not. P.S. I have just tried it, though (on purpose), for some reason it didn't work. Perhaps, it needs some further tweaking? Commented Jul 6, 2016 at 14:18
  • 8
    IMO, the form shouldn't let you submit as long as your post contains HTML that would get stripped.
    – Siguza
    Commented Jul 6, 2016 at 19:46
  • 3
    @Siguza there are some valid reasons to allow at least HTML comments. We also use some other cool tags that let us do things like <sup>square<sup> numbers or make pretty <kbd>Ctrl</kbd> commands. (They don't work in comments, ofc, but refusing XML/HTML seems hard to do without removing other features). Commented Jul 6, 2016 at 19:48
  • 6
    One would think that the post preview gives enough feedback as for whether the correct formatting is being used or not. But as it stands, many people just don’t seem to care about the formatting, so I doubt any additional “nagging” will help at all.
    – poke
    Commented Jul 6, 2016 at 19:51
  • @Dannnno I am well aware of that, which is why I suggested that only "[such] HTML that would get stripped" should trigger such behaviour. The parser has to specifically look for HTML tags that aren't whitelisted and strip them anyway, so that shouldn't be a problem.
    – Siguza
    Commented Jul 6, 2016 at 19:54
  • @Siguza There are some legitimate uses for having stripped HTML. It affects how markdown is parsed, like here: meta.stackoverflow.com/a/321953/6083675
    – Laurel
    Commented Jul 6, 2016 at 20:10
  • what about auto-correct instead of nagging?
    – Aprillion
    Commented Jul 6, 2016 at 20:23
  • There's already a wysiwyg preview for questions and answers, and it's possible to edit them. There's also an help page on how to format a message. Adding more features to help users to write a poor message is a risk to make users (that see and know that messages can be formatted or better formatted) more childish. Commented Jul 6, 2016 at 20:40
  • 2
    It is true that some folks might need to insert invisible text for some reasons, and there are plenty of those valid reasons. IMO, those should always be inserted as <!-- blabla --> markup. So, I suggest that the engine forbid/refuse/disallow posts or edits of any question or answer that includes some stripped HTML other than <!-- blabla -->. If this is considered too aggressive or if there is some rare corner-case where this is deemed as valid (I don't think so), warn the user about the stripped text and ask for confirmation when he/she clicks the button to commit the post/edit. Commented Jul 7, 2016 at 7:51

0

You must log in to answer this question.

Browse other questions tagged .