Keywords in comments

I did a search but couldn't find anything relating to this issue. A picture's worth a thousand words:


The image above was snipped from post -

Notice that the site doesn't detect the double slash comment and prints keywords in bold.

Thanks @dougp. It should be working as expected now. Somebody had set the default language for code highlighting as "c+++" in the forum settings. Since the forum software's highlighting system had no such language, it was highlighting the code as some other language. I'm not sure which one it was picking, but it certainly was not C++.

I have corrected the setting so that it now uses C++ as the default language for highlighting:

if (myButtonPressed) {
  if (myCounter >= 120) {
    // do over 120 and over stuff
  else {
    // do under 120 stuff

This behavior of defaulting to syntax highlighting for C++ can sometimes result in odd highlighting of non-C++ code blocks such as compilation output. For this type of output, best practices is to use the text syntax highlighting identifier to disable highlighting in that fenced code block:

some text here

The full list of supported languages:

  • apache
  • bash
  • cs (C#)
  • cpp
  • css
  • coffeescript
  • diff
  • xml
  • http
  • ini
  • json
  • java
  • javascript
  • makefile
  • markdown
  • nginx
  • objectivec
  • ruby
  • perl
  • php
  • python
  • sql
  • handlebars

For example:

# some Python code

Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.