3
\$\begingroup\$

When looking at this question, I noticed that the syntax highlighting wasn't that great, most likely due to the mix of one block with HTML and Angular2 and blocks with TypeScript.

I decided to improve it by adding the necessary language hints -- <!-- language: lang-or-tag-here --> -- but looking through the canonical answer on the main Meta site, I cannot find either TypeScript or Angular2+ .

Is there support for these two languages and is it simply not documented? Or are these missing?

\$\endgroup\$
1
  • \$\begingroup\$ There might be support for these languages in google prettify. If that's the case, lang-or-tag-here should be the prettify declaration for angular. Worst case you should consider highlighting for JS \$\endgroup\$
    – Vogel612
    Jul 19, 2017 at 9:35

1 Answer 1

3
\$\begingroup\$

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: lang-typescript --> worked to make the rest of the codeblocks format with the TypeScript syntax highlighting.


I also removed the JavaScript tag, as TypeScript is a super set of JavaScript, and is a different language. This IMO should have defaulted to using language-all: lang-typescript, but didn't.

Since the OP also isn't using SASS in the question I removed that tag. I also removed the Angular.JS tag too, as it's using Angular-2+. Which now defaults the codeblocks to use TypeScript as the default syntax highlighting.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ To note, TypeScript's language isn't set on the tag. So I'm not really sure why it works... \$\endgroup\$
    – Peilonrayz Mod
    Jul 19, 2017 at 10:40

You must log in to answer this question.

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