18

Recently in the edit queue, there have been edits that only add <!-- language: bash --> to the post. These edits are made by the same user. And often 5-10 at a time.

Is the color highlighting of code really a necessary edit? Presently I have been skipping them because I don't know if this should be considered an improvement.

Example:

https://askubuntu.com/review/suggested-edits/774796

5
  • 4
    Worth considering - bulk edits kinda annoy some users, but doing them in batches is the only way to. If there's more stuff to improve on... things actually get more complex. tbh, posting on meta before trying to fix a bunch of stuff is a good idea so good start ;) Nov 11, 2017 at 14:50
  • 3
    Why is the -- in the title rendered as ? That's highly disturbing in this case!
    – dessert
    Nov 14, 2017 at 11:33
  • @dessert -- it is automatic text formating. In text editors an long dash is usually entered with --. If you click edit you will see the -- is entered, but SE is displaying the dash.
    – ravery
    Nov 14, 2017 at 12:30
  • @ravery That's perfectly understandable, but here it's plain wrong. Is there really nothing we can do about it?
    – dessert
    Nov 14, 2017 at 12:53
  • @dessert -- appearantly the only thing that changes it is removing the space after --
    – ravery
    Nov 14, 2017 at 13:20

4 Answers 4

20

Yes, syntax highlighting of anything more than a couple of lines is a readability improvement. While the software used to apply syntax highlighting isn't all that great, it has rendered obvious some syntax problems in a few cases. Such edits don't fit under the usual reject reasons, certainly not the reason that says the edit doesn't improve the post at all.

4
  • I have never seen it before, is it a new feature? or just little used?
    – ravery
    Nov 11, 2017 at 14:29
  • 7
    @ravery A mix of both. It's a feature of advanced format highlighting, but if you go to a python tagged question it presumes python code formatting for any code blocks. This is something that came from SO I believe, but in many cases you may not want Python highlighting on, say, a Perl script solution, so you can override the highlighting. It's a little known feature actually, buried in the advanced how to for formatting on SE.
    – Thomas Ward Mod
    Nov 11, 2017 at 14:31
  • Personally I disagree with code-formatting-only edits, but that's my personal opinion and not my moderator opinion. That said, it doesn't mean that it's not a valid edit reason, so there's nothing against it.
    – Thomas Ward Mod
    Nov 11, 2017 at 14:39
  • 6
18

Just look at the examples. Does it matter?

enter image description here

If you are used to read syntax highlighting in a specific language:

YES

The other way around, on e.g. a .desktop file, (default bash) highlighting can be seriously distracting:

enter image description here

So yes, correct syntax highlighting is i.m.o. one of the most important tools to improve readability, and I love those edits.

9
  • I normally use a plain text editor for writing html code. So for me the colors are distracting. PS - I started writing code 30 years ago and have never relied on a syntax highlighter.
    – ravery
    Nov 11, 2017 at 17:51
  • 5
    @ravery Writing python, unhighlighted coded is nearly unreadable for me. Look at the weird highlighting of the .desktop file. The default on AU on anything defined as code Nov 11, 2017 at 17:59
  • 2
    @ravery Exactly - you've coded for 30 years, and that's admiring, but we also have users who're clueless about programming, and it kinda helps - they'd go "oh, that blue thingy is a keyword!" Nov 14, 2017 at 0:51
  • @SergiyKolodyazhnyy -- I understand everyones point about syntax highlighting; but when I look at highlighted code, my eye jumps from keyword to keyword completely ignoring the text in between. I have to force myself to ignore the highlighting in order to read the script and understand what it is doing. I'm pretty sure that I am not alone in this. Perhaps the difference stems from earning an MA degree instead of a MS degree - ie many years scanning voluminous text for significant or relevant information.
    – ravery
    Nov 14, 2017 at 12:27
  • 2
    @ravery psychologically, the recognition order of what the mind detects is color > shape. There are numerous interesting tests on that. The fact that it distracts you actually confirms that. It means you are not trained to get the advantage of highlighting, simply because you never used it. For anyone else, in a single glimp, the framework and structure of the code appears. Highlighting exists for a reason. Suggesting it is related to a degree is, well... Nov 14, 2017 at 12:36
  • @JacobVlijm -- Framework and structure can also be seen by looking at the first word of each indent level. As in the examples above. it is easily seen that the script is a if/then statement within a while loop. As noted earlier, I started programing long before a GUI desktop and text color was available on PCs. Code formating (line breaks and indents), is more significant to me than highlighting. My first experience with programing was an Atari with a BASIC cartridge installed then BASIC and FORTH on a Tandy TSR-80.
    – ravery
    Nov 14, 2017 at 13:14
  • @ravery not sure what we are actually discussing here, are you suggesting syntax highlighting is useless? Nov 14, 2017 at 14:16
  • @JacobVlijm -- No. Just saying that text format is just as valuable. In most cases the compiler/interpreter doesn't care about text formating, It is included for readability.
    – ravery
    Nov 14, 2017 at 14:50
  • @ravery That's cool ! My first coding experience was with Turbo Pascal, with that blue background editor a la MS Edit, I don't know what sort of computers those were - I was in middle school and didn't really care back then. Nov 14, 2017 at 17:29
8

Here's just my 2-cents on this:

  • color highlighting improves clarity and readability of code, hence improves clarity and readability of the edited post, makes it easier to read (related post).
  • they're not destructive and don't alter original content
  • they change wall-of-text code into easier to read code (bullet point 2 from here)
  • posts where multiple languages are used can benefit from added syntax highlighting; in fact, I frequently post answers that provide solutions in bash, perl, python, and others, and syntax highlighting helps distinguishing the syntax of each solution.
  • merely using tags as dessert's answer suggests can work for single-language posts ( IMHO ), but not in multi-language posts, plus as Zanna pointed out - tags can be removed.

Personally, I see absolutely no problem whatsoever with such edits. In fact, feel free to edit my answers any time just to add syntax high-lighting. I've like 1699 answers by this point, and prettyfying that many is time consuming :)

4
  • +1 Although I don't think dessert is against edits that apply syntax highlighting markup to ensure appropriate highlighting in multi-language posts, I strongly agree with everything else you've said in this answer (and if I understand you correctly, I also agree with your more general point about multiple languages). Edits that add markup that correctly specifies syntax highlighting are almost always good edits, for exactly the reasons you've stated. Nov 14, 2017 at 3:39
  • @EliahKagan yep, I don't think dessert's against it at all, and I think he has a point - adding appropriate tag will work where everything is related to that specific tag. There's a lot of other cases to consider of course. And like I said, personally I see no problem with such edits, and I'm in no way opposed to what dessert's saying. Just trying to contribute to the discussion, that's all. Nov 14, 2017 at 3:50
  • 2
    Understood. And I'm glad you are -- this is the best answer, I think. Nov 14, 2017 at 3:54
  • 2
    To me the important part is 'they're not destructive and don't alter original content'. It's not changing the OP's text and it coul help someone. (As long as it's done properly)
    – user689314
    Nov 21, 2017 at 18:12
4

I also came across edits of this type and treated them as follows:

Approve
if the edit actually improved the post by triggering correct syntax highlighting while it wasn't possible to just add a tag, e.g. an answer contains a bash script while the question isn't really about bash.

Reject
if the syntax highlighting was already fine before the edit, e.g. an answer contains a bash script, but the question is already (or can be → Reject and Edit) tagged and is unlikely to lose this tag – the edit did not produce any visible improvement.


These edits are made by the same user.

A thought about this part of your question which seems to have disappeared over the whole yes-we-really-need-syntax-highlighting discussion: The ones I encountered also were merely, if not all, from that exact user. At first glance it may seem like a loophole to quickly gain lots of reputation, but:

  • you can't just go through every question and blindly add <!-- language: bash --> to every piece of code you encounter, there is definitely work involved
  • no matter how much work is needed in the end, an edit improving a post is worth a reward no matter what
9
  • 3
    but what if the post were later edited to remove the tag?
    – Zanna Mod
    Nov 12, 2017 at 19:20
  • @Zanna I carefully checked whether the tag is likely to be removed. bash doesn't strike me as an ambiguous tag, and this is the only one I encountered so far.
    – dessert
    Nov 12, 2017 at 19:27
  • 1
    Regardless of how question is tagged, syntax high lighting really helps to see the syntax, separate keywords from variables, etc. Especially useful for users who've no clue about shells. In addition, questions can often be tackled in multitude of languages or with multitude of tools, not just what is in the tags. Tags are used to indicate the relevant topics of the question, which also helps relevant people to find and answer those questions. It's really apples and oranges. Nov 14, 2017 at 0:48
  • @SergiyKolodyazhnyy What is syntax highlighting and how does it work? says: "Behind the scenes, Stack Exchanges uses the tags on the question to infer the language you are using. If there's more than one tag that has syntax highlighting, it uses a default and lets Prettify infer what's the best language to use." So it's not apples and oranges: tags are enough to trigger syntax highlighting. But I disagree with this meta answer, at least for edits on answers, which can move to a different question in a merge. Nov 14, 2017 at 2:49
  • @EliahKagan I'm well aware that tags alone trigger syntax highlighting. My point is that tags and syntax highlighting serve different underlining purposes. Nov 14, 2017 at 3:00
  • 1
    @SergiyKolodyazhnyy I think you may want to read this meta answer again. What dessert is saying here is that some edits that add HTML comments that tell Prettify to apply syntax highlighting should be rejected because the syntax highlighting they request is already being applied, and thus the edits do not actually improve the post, or should be rejected because a markedly better improvement is simply to add the necessary tag, thus achieving both the goal of proper tagging and the goal of syntax highlighting. dessert supports adding syntax highlighting even when no tag should be added. Nov 14, 2017 at 3:07
  • Seems like I wasn't able to clearly express my point here: Yes, I strongly support syntax highlighting, there's no doubt it helps and every piece of code on a SE site should appear highlighted correctly IMO. But, I reject edits that don't add to the post. This is in fact a rare condition, but I encountered those edits on questions that are crystal-clear bash questions and it would just be vandalism to remove that tag.
    – dessert
    Nov 14, 2017 at 9:06
  • @dessert why wouldn't a bash question not get a python or perl answer? Even more, why wouldn't a single answer not include (now or in future) multiple languages? Numerous examples. Nov 14, 2017 at 12:09
  • @JacobVlijm Am I still misunderstood here? Of course a case like this would fall in the first section and get approved, my example refered to the common case of a bash tagged question receiving an answer with a bash script which then is edited as described in the question.
    – dessert
    Nov 14, 2017 at 12:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .