I looked into what does the SE version of prettify.js actually do. Turns out, its list of C# keywords starts like this (only with minified names):
var CSHARP_KEYWORDS = [JAVA_KEYWORDS,
"as,base,by,checked,decimal,delegate,descending,dynamic,event," + …
This list is from an old version of prettify, the current version starts like this (the relevant change ...
Thanks for bringing it up.
The matlab tag had no syntax highlighting language associated to it.
I've modified the tag settings to use lang-matlab, which should fix the automatic syntax highlighting in that language.
code-prettify works by adding <span class="..."> elements into the prettified code with classes for different syntax elements. The supported elements for lang-vb are "plain", "string", "comment", "keyword", "literal" and "punctuation".
The colors themselves are controlled by a stylesheet provisioned by Stack Exchange (you're looking for primary.css), ...
The language syntax highlighting used in Code Review (normally) comes from the language tag set on the post. This is one of the reasons we have only one language tag per post.
The language syntax highlighting is done through a prettify script that is used in all code-related Stack Exchange sites.
The "definitive" guide is here: What is syntax highlighting ...
The tag didn't have an associated syntax highlighter, so the highlighting you'd get with the go tag alone would have been the default one.
<!-- language: lang-go -->
should actually be
<!-- language: lang-golang -->
That's the highlighter I've just associated with the go tag, so all GO questions and answers should now have correct & ...
I agree with this, and in particular I find comments are hard to read — comments are just as important as code, but displaying them in grey on a grey background suggests that they are not important.
Good luck getting this improved, though: when I raised this issue previously I was told that it's my problem that I don't have perfect vision.
So what I do ...
We don't have a PowerShell syntax highlighter, because Google Prettify doesn't have a PowerShell plugin. What you see is the "best guess one-size-fits-all" default highlighter trying its best. There's an open issue request on Prettify that includes a plugin, but it's only a partial implementation. I'd be happy to include the PowerShell highlighter when it's ...
The default syntax highlighter uses a "one size tries to fit all" approach, which will not always be successful. I have changed the setting for the css tag such that not the default highlighter, but the CSS-specific highlighter is used for questions with this tag (example).
In general, you can also manually specify which highlighter is to be used, by ...
As per the Stack Exchange syntax highlighting guide:
What is syntax highlighting and how does it work?
Stack Exchange does not have its own syntax highlighting engine. It
uses Google Code Prettify. Therefore, any bugs and feature requests
regarding syntax highlighting cannot be handled by Stack Exchange and
should be directed to the team behind ...
On Code Review, when you ask a Python question that only works in one of the versions, Python 3, then you should tag it with both the language tag python and the version tag python-3.x. One explanation as to why we do this can be found in this answer.
And so, sure it's a bug, but if we stick to the way that we are already tagging Python questions then it ...
You can specify the used language by inserting the following in your post. Thanks to Mat's Mug you can now use:
<!-- language: lang-matlab -->
This particular example makes SE think all the code blocks in the question are MATLAB code.
If your language is not supported, simply turn it off:
<!-- language: lang-none -->
You used the wrong name for the language hints. I change the question in revision 5 to fix these.
The GitHub repo for Googles code-prettify, isn't incredibly descriptive on how to specify the languages, however it's common for them to follow the format of lang-*.
In this case, using lang-html for the HTML code worked fine. And using <!-- language-all: ...
It is commonly accepted wisdom that "Only perl can parse Perl". Every syntax highlighter I have seen has bugs when highlighting Perl code, especially regexes.
I don't recommend modifying your code just to appease the syntax highlighter on Code Review. You can either mention at the end of the question that the syntax highlighter is sloppy, or just turn off ...