Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

There is a code syntax highlighting problem which had been fixed a long time ago, but for the last couple of weeks appears again. Usually it would automatically detect that the code sample is VB.NET (because of tag I think) and format it properly. In the last weeks I have to add the markup <!-- language-all: lang-vb --> for my code samples to display properly.

For example, if you look at my answer from this question you can see that code is highlighted properly, because I added the markup tag to specify that the language is VB. But if you remove the hint, then it doesn't recognize VB (comments aren't displayed properly).

share|improve this question
I'm not entirely sure how this works, but it looks like the [mysql] tag is picked up first for syntax highlighting since it appears first in the question's tag list. Hence the highlighting issue for your answer. Not entirely sure if this can be fixed, since the highlighter doesn't really intelligently examine the code - it just looks for some keywords, so it can't tell SQL apart from VB or anything else. – Adam Mar 16 '12 at 20:39
Anna's right, the [mysql] and [] tags are fighting, and the SQL syntax hint is winning. Manually specifying it works, because that overrides the tag's default language hint. So this is not the same problem as before that is resurging, it's an entirely different problem. I can't think of a good way to fix it, since SQL and VB.NET code should be formatted differently. This is why we allow manually specifying the syntax hinting, so I'd say you've done the right thing. – Cody Gray Mar 17 '12 at 3:30
Use two quotes in a snippet, '' like this. – Uphill Luge Mar 17 '12 at 6:17
@CodyGray: I think you're right, I can see that questions tagged only are OK, but it seemed to me that even when mixing tags, VB.NET code was correctly detected before, but not anymore (it happens with other tags not just mysql). – Meta-Knight Mar 17 '12 at 15:05
@UphillLuge: Might as well add the language hint... – Meta-Knight Mar 17 '12 at 15:06
Seconding what @AnnaLear has said - both mysql and have tag-level syntax highlighting hints set, which override the highlighter's normal "figure it out" mode. Because mysql is the more prominent tag, it's going to win. You'll have to add the hint in this case. – Jarrod Dixon Mar 18 '12 at 7:33

You must log in to answer this question.

Browse other questions tagged .