Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
8

The highlighting will work if you use <pre><code> instead of just <pre>. However it is preferred that you use the regular markdown syntax for code samples (i.e. indent by four spaces). There's a button in the formatting toolbar (the one with the {}) as well as a keyboard shortcut (ctrl+k) to do this for you, so you don't need to indent ...


7

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 ...


7

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.


6

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 ...


5

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 & ...


5

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 ...


5

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 ...


4

I've set the code language hint for the Lua tag to use... Lua highlighting. All appears as should be now.


4

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 ...


4

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 ...


3

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 ...


3

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 -->


3

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: ...


1

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 ...


Only top voted, non community-wiki answers of a minimum length are eligible