The third code block in this question has the right colors - attribute names are red and the values are blue; whereas in this other question colors for the same tokens are black and brown, why is this, and could one do something to enforce correct colors for code?
What is meta?
- Any Stack Exchange user can ask a question
- The community provides support, votes on ideas, and reports bugs
- Your voice helps shape the way Stack Exchange operates
The problem is the broken post has two tags, html and css, that both have syntax highlighting associated with them. I don't know how SO decides between them, but for some reason it's decided to go with CSS syntax highlighting for the whole page, even though that code snippet is actually in HTML. In cases like this the language can be set manually, using
For example (markdown), this version is
The list of available languages is here
Edit: I just noticed this in Jeff's post:
So either prettify is guessing completely wrong, or that feature doesn't appear to work right
See http://stackoverflow.com/editing-help#syntax-highlighting - you need to specify the language explicitly or you have to live with the fact that the automatic detection might go wrong. I added the necessary comment to the second question and now it also highlights the text correctly.