The syntax highlighting FAQ page shows code samples in all black text. Is something broken with the syntax coloring feature?

Here's what I see on What is syntax highlighting and how does it work? using the latest version of Chrome (72.0.3626.109) on MacOS Mojave.

enter image description here

I can confirm that something seems wrong. If I copy the code samples from that FAQ page, they're not colored. UPDATE: now the JS snippet is colored OK, but the TS one is still not colored.

var arr = [0, 1, 2];
function greet(person) {
    return "Hello " + person;
var user = "John Doe";

I'm also seeing a JS syntax error in my Chrome devtools console. Not sure if this is related. The problem code is this:

StackExchange.tagEditor.requiredTags =;

as part of this:

StackExchange.using("tagEditor", function () { StackExchange.tagEditor.requiredTags =;[{"Name":"discussion","Count":31198,"Excerpt":"Questions that may not necessarily have a clear-cut right or wrong answer and are often subjective. If your question isn\u0027t a bug report, feature request, or request for assistance, or question with a concrete answer, it\u0027s probably a discussion.\r\n","IsDiverged":false,"InfoUrl":"/tags/discussion/info"},{"Name":"feature-request","Count":22960,"Excerpt":"Proposals for new features on the Stack Exchange network, or requests for a change to an existing feature.","IsDiverged":false,"InfoUrl":"/tags/feature-request/info"},{"Name":"support","Count":21797,"Excerpt":"A request for assistance with one of the site\u0027s features, or a question where you\u0027re expecting a concrete answer, and not discussion. If your question is not reporting a bug, requesting a new feature, or soliciting opinionated discussion, this tag is probably the right one.","IsDiverged":false,"InfoUrl":"/tags/support/info"},{"Name":"bug","Count":19064,"Excerpt":"Indicates a reproducible problem on the site that you believe is due to a mistake, malfunction, or programming error.","IsDiverged":false,"InfoUrl":"/tags/bug/info"}];; });

I don't have any ad blockers or other browser plugins that would explain behavior like this.


In order for something to have syntax highlighting it must either:

  • Be a question (or answer under a question) with a tag that has syntax highlighting enabled. You can check this in the tag wiki. For example, at the bottom of SO's [java] tag wiki it says: "Code Language (used for syntax highlighting): lang-java"
  • Have <!-- language-all: java --> anywhere in the post or <!-- language: java --> right before a code block (neither of these will actually work if put inside a code block). With the introduction of fences, you can also do:


Neither of these conditions is met for the post in question, so it's woking correctly.

| improve this answer | |
  • <!-- language: typescript --> is not working in my post above nor the FAQ. <!-- language: lang-js --> is working in my post but not in the FAQ. Still seems like a bug. Expected? – Justin Grant Feb 18 '19 at 22:44
  • @JustinGrant There is no typescript tag on this site and it has no language code, so that's the expected behavior. Unlike typescript, lang-js is on the list of supported language codes. – Laurel Feb 18 '19 at 22:48
  • Got it. That's the part I didn't understand beforehand: that the tags must be actually on the question before highlighting will work. If you just create a new question and copy the highlighting sample from the FAQ, the TS snippet will be highlighted only after you add the typescript tag to the question. – Justin Grant Feb 18 '19 at 23:22
  • @JustinGrant No, they just have to exist on the site where you are asking the question. The FAQ was written with Stack Overflow's tags in mind, not Meta Stack Exchange. There's no need to add a hint if you have the proper tags. – Laurel Feb 18 '19 at 23:24

That code block is an example of Markdown. It doesn't really make any sense for any code formatting to be applied to it, because it contains random text that isn't code also. Syntax highlighting is intentionally not applied there.

Your typescript example here doesn't work because there is no typescript tag here to look at and get the corresponding language (see the "Hinting: Tags" section). It's just an example of how you might type something, not necessarily a working example for every site and definitely not a functional example that shows how it looks.

| improve this answer | |

You must log in to answer this question.

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