What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

Possible Duplicate:
Why isn't syntax highlighting working in a question?
Why isn't code coloured as it should be?

I do not get it. If you look at this answer, you can see that the syntax highlight works in the way as i was intended to have it. But the same code does not work in this question

  • Why is that, how can i avoid damageing the syntax highlight?
  • Is it possiblie to force a special syntax?
  • Is there a "good practice" example or tutorial, to avoid bad behavior in highlighting?
share|improve this question

marked as duplicate by Cody Gray, kiamlaluno, Pops, jonsca, Kevin Vermeer Jul 25 '12 at 23:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 6 down vote accepted

There's no syntax highlighting because the question is lacking relevant tags.

Tags are used as default syntax highlighting hints. For example, if the question is tagged , then the code will be treated as if it were JavaScript for highlighting purposes. This is the case with the question for which your answer is correctly highlighted, but is not the case for the other question.

So the best solution for questions is just to make sure that they are tagged correctly. That's important for lots of reasons above and beyond syntax highlighting.

If you can't get the tags to apply the syntax highlighting you desire, or you have an answer in which you want to provide snippets of code in multiple languages not mentioned in the question, then you can provide an explicit syntax highlighting hint, as discussed here.

share|improve this answer
3  
i did not know that tags have such a high impact :) thought they are just for "searching" reasons :) –  Neysor Mar 29 '12 at 19:29

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