Skip to main content
5 of 11
edited title
Breakthrough
  • 34.6k
  • 16
  • 17

Can we activate syntax highlighting for code blocks based on the question's tags?

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 would. 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.

terdon
  • 53.7k
  • 15
  • 23