-- this is a comment
UPDATE Employees SET fired = 1 WHERE noiseLevelInDB > 80
  • 2
    Count your blessings; to make VB look right, you have to use ''# as the comment character. – mmyers Mar 2 '10 at 19:57
  • @mmyers: no, to make VB look right you have to resort to controlled substances. – squillman Mar 2 '10 at 20:16
  • Deferred to google, since they own the syntax-highlighting code. – Joel Coehoorn Mar 2 '10 at 21:26
  • 2
    I do not envy the person whose job it is to determine that i-- is not a comment but --comment is, but make --install is not... – Mark Henderson Mar 2 '10 at 23:56
  • I assume that the code attempts to identify the language first, and then falls into a language-specific highlighter. Once it understands that it's in SQL (and I suspect that it does, since Employees seems to be highlighted as a table name, although it could just be keying off the uppercase and assuming it's a classname), recognizing a -- comment should be trivial. – sidereal Mar 3 '10 at 1:43
  • I think it just highlights any capitalized words (except words in all-uppercase). – mmyers Mar 3 '10 at 16:40
  • 1
    @Joel Coehoorn, We wouldn't have to wait for google if they (SO Team) allowed class attribute on the pre tag. meta.stackexchange.com/questions/981/syntax-highlighting-hints/… And they could only accept supported languages as the class attribute's value to avoid trickery with the site's layout. – çağdaş Mar 4 '10 at 8:07

In this case I suspect the problem is that the code is detected as a language other than sql, but I could be wrong about that. Either way, the syntax highlighting is done using google's prettify.js tool, so I deferred the request.

  • Although this example was trivial enough that I could imagine it not recognizing the language, the impetus for the report was a question on the main stackoverflow site where it was clear it recognized SQL (select and where keywords were highlighted, etc), but a comment wasn't recognized. – sidereal Mar 3 '10 at 1:46

The code block should recognize every language ever known, and highlight the syntax appropriately. Let's get this fixed.

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