1
$\begingroup$

I'm getting syntax highlighting for c and cpp, but not objc or objective-c. Compare:

const char *lang_name = "c";
std::string langName = "cpp";
NSString *kLangName = @"objc";
NSString *kLangName = @"objective-c";

Am I using the wrong language name, or is Objective-C syntax highlighting not available?

$\endgroup$
3
  • $\begingroup$ See this post, it hasn't been activated yet. $\endgroup$
    – Starship
    Commented May 18, 2023 at 21:44
  • $\begingroup$ @Starshipisgoforlaunch That doesn’t explain it, because if that were the case it wouldn’t work for C or C++ either. $\endgroup$
    – Bbrk24
    Commented May 18, 2023 at 21:53
  • $\begingroup$ @Starshipisgoforlaunch it is activated. $\endgroup$
    – naffetS
    Commented May 18, 2023 at 21:54

1 Answer 1

3
$\begingroup$

Syntax highlighting is somewhat counterintuitive when coming from other established sites. With some exceptions, the short form of highlighting specifications normally rely on the existence of a tag and the tag languages being set when the tag doesn't match a known lang- identifier.

The approach that will always work regardless of site or tag language is to use the full qualified language identifier; these all start with a lang- prefix.

According to What is syntax highlighting and how does it work?, the objective c identifiers are:

Objective-C: lang-objectivec, (lang-mm, lang-objc, lang-obj-c, lang-obj-c++, lang-objective-c++)

See the working samples below:

``` lang-objectivec
NSString *kLangName = @"objective-c";
```
NSString *kLangName = @"objective-c";
``` lang-objc
NSString *kLangName = @"objective-c";
```
NSString *kLangName = @"objective-c";
$\endgroup$

You must log in to answer this question.

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