13

I think it is time to revisit the syntax highlighting question. There is a similar request that suggests using HTML comments to activate highlighting for specific posts. I would rather implement something like we have over on SO and U&L where syntax highlighting is activated according to a question's tags.

So, if a question is tagged as , any <code></code> blocks in the answer get bash highlighting. If it is tagged as , the questions get Perl syntax highlighting etc.

I agree with the decision to turn off syntax highlighting on SU by default. It was indeed more often a hindrance than a help. Nevertheless, while many, if not most, SU posts do not need and should not have syntax highlighting, there are many that do. For example, many of these:

While not all would benefit from syntax highlighting, many would. Since this is already implemented in a tag-dependent manner on U&L I imagine it would be simple to also activate it here. I think that syntax highlighting only for certain tags would improve SU while not affecting the great majority of questions that need no highlighting.

I would also be happy if we could simply allow the HTML comments to prettify code as suggested in the question linked above. Anything that allows me to optionally allow code highlighting, at the very least for my own answers, would be great.

11
  • @oliver-salzburg I rolled back your edit because the whole point is about tag dependent highlighting, it has nothing to do with tab.
    – terdon
    Jul 3, 2013 at 16:34
  • Erm, well, yeah :D Thanks @Breakthrough ;D Jul 3, 2013 at 17:01
  • @terdon, I think you might have read a cached copy of the question since his revision did fix the typo. Regardless, I just edited the title to be a bit more clear and phrased as a question to get rid of any confusion. I like the idea of this feature, but is there any way you can disable the highlighting for a particular code block? (e.g. for terminal outputs or log files which shouldn't be highlighted) Jul 3, 2013 at 17:03
  • @Breakthrough thanks for the edit, it is indeed clearer. As for selective deactivation, I don't know, we should ask the devs.
    – terdon
    Jul 3, 2013 at 17:27
  • @OliverSalzburg I seem to have a form of selective dyslexia, sorry, no idea what was going on between my eyes and brain there.
    – terdon
    Jul 3, 2013 at 17:28
  • This will likely be discussed next Thursday, I'll post a reply or follow up shortly after.
    – Tim Post
    Sep 27, 2013 at 15:52
  • @TimPost great! Please let me know, I'd love to be able to (selectively) activate syntax highlighting.
    – terdon
    Sep 27, 2013 at 16:03
  • @TimPost any news on this?
    – terdon
    Oct 10, 2013 at 18:03
  • @terdon Devs are currently backlogged with the small features we've been sending them, give it another week - I promise I'll update here once I have news.
    – Tim Post
    Oct 10, 2013 at 18:26
  • @TimPost that's fine, didn't mean to put pressure on you guys. Now that I know you haven't forgotten (which should have been quite understandable) I won't bug you for at least another week ;). Thanks.
    – terdon
    Oct 10, 2013 at 18:27
  • 1
    @terdon It's normally not this backed up, but they're also working on something quite large that also came from us. Once that's done, we go back to weekly feature discussions then sending 3 or 4 a week their way, which generally get implemented the next week. Believe it or not, we're actually getting almost efficient at handling feature requests that might make some sense. What is this world coming to?!
    – Tim Post
    Oct 10, 2013 at 18:29

2 Answers 2

5

This is now enabled, but there's no default language set, which means you'll need to provide hinting as to what scheme should be used for it to show.

On a few tags, by tag kind of makes sense for obvious reasons. However, in others .. it wouldn't, depending on the content of the post. In order to stay consistent, we're just allowing manual hints as needed, which is a little less confusing to the non-ninjas posting their first few contributions.

1
  • SWEET! Thanks :)
    – terdon
    Jan 16, 2014 at 16:42
3

As a regular user of SO, U&L, and SU, I somewhat frequently get annoyed that syntax highlighting, even through explicit prettify language codes, is not available on SU. I was not around during the time it was active, but I can well imagine the havoc and confusion automatic inclusion caused. However, we do see a fair amount of "programming lite" questions here (734 ones, for example, as well as those already-mentioned and questions, along with those disguised under , , , etc.), and while these are admittedly a small portion of the 182,650+ questions currently on the site, those of us that look for and answer them would probably appreciate the chance to optionally add a bit of prettify goodness, at least to our answers, if not into the questions themselves.

1
  • I could have sworn I once saw working syntax highlighting enforced through the language comment. But it isn't working right now, that's for sure. Aug 6, 2013 at 16:31

You must log in to answer this question.

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