# Mass editing of syntax highlighting - good or bad?

I've noticed that this user is making a lot of edits lately, and all they do is add the <!--language: * --> syntax highlighting hint.

Now, I'm not saying this is bad (props to that user for trying to help improve the site!), but should posts be edited for only minor syntax coloring hints (which has a side-effect of bumping the posts to the front page as well)?

(I've also noticed that this user is only editing new posts, and avoiding bumping old posts, which is also a nice thing to notice, so thanks to that user for that also.)

• I certainly say that posts should not be bumped in large numbers for such a tweak. A few at a time is more manageable. – dmckee Feb 27 '14 at 4:44
• That user was chasing the Strunk and White badge. I suspect he's chasing moderator status if and when we graduate. – Gareth Feb 27 '14 at 9:40
• Additionally, some of the syntax highlighting code he added (e. g. here) are not only not implemented, but don't even exist in Google Code Prettify (and if one day they might, there is no reason to believe the code for them will be the one he used). – plannapus Feb 27 '14 at 13:15
• And some of them don't work so well. e.g. codegolf.stackexchange.com/a/22332/3363 – Jonathan Van Matre Feb 27 '14 at 18:12
• @plannapus See my answer. The syntax highlighting worked for me, so I do not understand what do you think that is wrong. – Victor Stafusa Feb 27 '14 at 20:34
• @JonathanVanMatre If you didn't liked it, go on and rollback it. Just tell me why it didn't worked well, because for me it is looking much better. – Victor Stafusa Feb 27 '14 at 20:35
• @Gareth See my answer. – Victor Stafusa Feb 27 '14 at 20:36
• @Doorknob I just ask that the next time that you create a meta-post about something that I am doing or did, please be polite and tell me by posting a comment to any of my posts. And do the same for any other user. – Victor Stafusa Feb 27 '14 at 20:44
• @Victor I just mean that the SQL formatting is pretty poor. It has no awareness that a single-quote in a comment is not the beginning of a string literal, for example, and it randomly colors some words in comments as if they are keywords. Some of them are not even SQL keywords. If we're going to have SQL syntax coloring, we should find out what DBA.se uses, because that seems to be much more sophisticated than the template you chose. – Jonathan Van Matre Feb 27 '14 at 20:47
• @JonathanVanMatre Ok, so either improve or rollback it. No hard feelings. – Victor Stafusa Feb 27 '14 at 20:48
• @Victor It didn't worked but because you specified a language it used the default syntax highlighting instead of none at all. So the thing are coloured indeed but not according to the specificities of the language. For the good reason that the syntax highlighting of that language are not implemented on stackexchange and doesn't exist in Google Code Prettify. The SE site on "Mathematica" created their own syntax highlighting (called using lang-mma i believe) but it is not implemented on other site of the network. – plannapus Feb 28 '14 at 7:33
• @Victor I understand the mistake: i have used lang-r to highlight the syntax of my r code for months and realized only this week this it is actually not implemented and the only reason it looked like it worked is because the "default" syntax highlighting recognized many of the things R has in common with many other languages. – plannapus Feb 28 '14 at 7:34
• The list of language actually implemented on SO (and the code snippet to call them) can be found here for further reference. – plannapus Feb 28 '14 at 7:38
• @plannapus Thank you for the reference. :) – Victor Stafusa Feb 28 '14 at 8:16
• New code-golf question - create a syntax highlighter for golfscript ;-) – Digital Trauma Mar 1 '14 at 20:55

I personally enjoy these syntax coloring edits. Several of my posts have been edited to include syntax coloring, and they became much more readable.

On a side note: before reading this post, I edited a large number of posts to include syntax coloring. Perhaps I should have done it at a smaller amount at a time.
Sorry.

• I also do some syntax highlighting edits in the First Posts queue, to show new users that it exists and how to use it. – ProgramFOX Apr 10 '14 at 18:07
• Yeah, I did the same, sorry. – nyuszika7h Apr 30 '14 at 16:12

I was about to write this as a comment, but to give it more relevance I'm writing this down here.

I actually appreciated it when he edited one of my answers; It made it more readable and understanding. It was a real eye-saver for anyone who wanted to give it a serious reading.

Since he's not bumping posts I don't think there's anything wrong with it. As others said, if one doesn't like the edit, he can rollback. I think that it should be done little by little, though.

While I agree with Peter Taylor, saying that's a minor edit, I disagree with the fact that's not worth an "Accept" button click. For longer posts it's really really helpful, and has a positive impact on people coming from the research engines (I actually was really surprised when I saw SO for the first time...).

Ok, lets enumerate some points:

1. Initially when I saw java answers, the lack of syntax coloring really makes the code horrible. By editing them it becames a lot better.

2. Quickly realized that this is not only a problem of java answers. This is a general problem. The syntax coloring is a good thing, and if no one starts that no one does that. This is a reason that I am disagreeing with @Peter Taylor. If we really want to improve the quality of this site, lets fix not only the big problems, but the small ones too.

3. I was careful to not bump old posts. I may accidentally had bumped one or two that I shouldn't, but I am really thinking to avoid this.

4. I am expecting that people follow my example. Go on people, lets improve the quality of this site. If you see something could be improved, do it. This is the way that a lot of other betas here on SE work. @Quincunx, nice that you enjoyed. Instead of stopping, I invite you to intesify this activity.

5. I am seeing now that the number of answers that already comes syntax-colored is raising (not by much, but it is). This is a sign that my strategy is starting to work. Some comes with broken syntax-coloring tags, meaning that some people are trying to experiment with them.

6. @Gareth, The Strunk & White badge is not only my objective. I already have it and I could stop after that, but I didn't. In fact I enjoy to fix other people questions and answers when I can. And frankly, it is a shame for a site that is more than 3 years in beta, that the first one to get that badge is active only in the last two months.

7. Most of my editions in fact are for adding syntax coloring and fixing small formatting stuff. But not all, by editing I already avoided some questions to be closed and made a few be reopened. I am proud of this.

8. @Jonathan Van Matre: If I see that the syntax coloring would not really improve the question/answer, I normally don't do it.

9. @Doorknob, thanks for saying that I am trying to improve the site. :)

10. I might had edited wrongly a few times, if so, sorry, I am human. But I think that in most of those edits, I did it right.

• Victor, I think you have taken this thread as criticism when it was meant more as a "Something new is happening, let's see if we can hammer out a policy about it while it's still new" discussion. My objections to the quality of the SQL pretty-printer aside (and that is not your fault), I applaud your desire to improve the site. Just understand that Meta topics like this one also stem from a desire to improve the site by promoting consistency and orderly behavior. I think the key concern is bumping old posts and thereby stealing attention from new ones, and your caution about that is great! – Jonathan Van Matre Feb 27 '14 at 23:14
• @JonathanVanMatre Ok thanks. But sorry, I do see some criticism here, including in your answer and specially in Peter Taylor's one. Anyway, I invite you too for this. Lets fix questions and answers, even if it is a minor thing like syntax highlighting. – Victor Stafusa Feb 27 '14 at 23:30
• It is a good idea to rate-limit yourself in order not to flood the main page. For instance, to 3 posts per day, all submitted at the same time. This requires more planning (for instance, keeping an edit list in a file), but there are 365 days in a year and thus plenty of capacity to absorb a large number of edits. (The rest of the time could be spent on Stack Overflow where there is a large number of terrible, terrible questions and where flooding is never a problem due to the very high rate of incoming questions.) – Peter Mortensen Feb 28 '14 at 22:46
• Victor edited one of my posts too, and taught me about the syntax highlighting control feature, which I actually didn't know about (on SO syntax is highlighted automatically, so I never had to use it explicitly before). I use it on all my posts now, so I appreciated it a lot. – Jason C Mar 1 '14 at 1:39

I think that in general syntax highlighting is too trivial to be the sole purpose of an edit. If I saw such an edit in the review queue, I would reject it on that basis.

• Please, see my answer. I am disagreeing with you. So lets debate this stuff. – Victor Stafusa Feb 27 '14 at 23:35
• @Victor, I don't think there's much to debate per se, because the root issue of how valuable syntax highlighting is is a matter of opinion. I've set out my opinion. If the community as a whole clearly disagrees with me then I won't try to enforce it (although it's somewhat hypothetical anyway, because I've never actually seen a proposed edit which added syntax highlighting), in the same way that I don't try to close every single popularity-contest question as off-topic. – Peter Taylor Feb 28 '14 at 8:38

I always assumed the lack of syntax-coloring here was by design. It makes more sense for a language-specific site (e.g. TeX.se, Mathematica.se, DBA.se)

It's worth noting that the way multi-language sites on SE achieve highlighting is by setting a default highlighting hint for language-specific tags. This works pretty well on SO where a questioner tags a question about C# and responses in C# are automatically highlighted. Here, with the rare exception of language-specific challenges, we have no way to use a tag to set a sensible default. That makes all syntax highlighting a manual process.

Since many of the golf answers are compressed to a single line anyway, what does syntax coloring add if 65% of it is hidden beyond the edge of the div?

On the whole, I like syntax highlighting. I just see syntax highlighting every post on PPCG as a potentially Sisyphean endeavor. If there are no sensible defaults, it leaves us with a lot of manual work.

• I'm not sure that you will be able to make a strong argument against syntax highlighting. That wasn't really the purpose of the original post here, either. In any case, there's a lot of other stuff here besides golf. – Jason C Mar 1 '14 at 1:40
• I'm not against syntax highlighting, but I do join Peter in being against a highlighting-only edit of an old post. – Jonathan Van Matre Mar 1 '14 at 14:37
• Also, it's worth noting that the way multi-language sites on SE achieve highlighting is by setting a default highlighting hint for language-specific tags. This works pretty well on SO where a questioner tags a question about C# and responses in C# are automatically highlighted. Here, with the rare exception of language-specific challenges, we have no way to use a tag to set a sensible default. That makes all syntax highlighting a manual process. – Jonathan Van Matre Mar 1 '14 at 14:39