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

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?

share|improve this question
    
    
@Conrad That appears to be completely unrelated –  Michael Mrozek Sep 21 '11 at 19:21
    
@Wladimir Palant fixed the second question (see his answer) so the difference no longer could be seen. –  Majid Fouladpour Sep 21 '11 at 19:31

2 Answers 2

up vote 4 down vote accepted

The problem is the broken post has two tags, and , 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 <!-- language: lang-XXX -->.

For example (markdown), this version is lang-html:

<div id="dialog-window">
  <div id="scrollable-content">
    what ever content here...div's, ul's and li's
  </div>
  <div id="footer">
  </div>
</div>

This is lang-css:

<div id="dialog-window">
  <div id="scrollable-content">
    what ever content here...div's, ul's and li's
  </div>
  <div id="footer">
  </div>
</div>

The list of available languages is here


Edit: I just noticed this in Jeff's post:

If a question has two tags that both define specific languages, it uses default and lets prettify infer as it always has.

So either prettify is guessing completely wrong, or that feature doesn't appear to work right

share|improve this answer

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.

share|improve this answer

You must log in to answer this question.

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