Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
@Josh To your direct question, I don't believe there is a list anywhere currently containing all tags with associated language, however. It also doesn't look like this info is accessible using SEDE either, it's not in the tags table.
@Wolf The lang- prefix isn't redundant. As mentioned in the post above, ```lang-javascript tells the highlighter to use the JS highlighter directly, while ```javascript alone tells it to look at the highlighter set for the tag [javascript]. They aren't always the same (maybe most notably with [typescript] on Stack Overflow).
Thanks a lot for clarifying. The post has so much text that it's hard to find this information. The tags I use obviously have the right highlighting connected to them, so it's easy to get the impression of redundancy for most people.
Is there a way to determine what syntax highlighting code is being applied to a given code block? For example, in instances where none of the tags are associated with language codes and so lang-default is used, I'd like to know which language highlight.js ultimately settled on based on the auto-recognition (since if I find one I like, I can manually specify it in future, as lang-default gives different results question to question even if I use the same language).
@Greedo You can sometimes tell by inspecting the code block on page using browser dev tools- I've found it somewhat inconsistent in the past, but most of the time the selected/ detected language itself is listed as a class on the code block. (Example)
@LeonardoAlvesMachado If you want it in an enterprise version of Stack Exchange, then you're probably best off asking for it through whatever official support channel for the product. Doing so will probably have significantly more weight wrt. getting it done than anything you can post on the public network. Posting a comment is ineffective. Posting a feature-request question might be? effective, but probably not. The answer to: "Julia syntax highlighting" is the current official response for any requests for additional languages on the public network.
@EvgenKo423 Do you have a source for the claim that questions using only tags with no syntax highlighting identifiers will not be highlighted at all vs. highlighted with automatic detection? Also, the name of the library is "highlight.js", not "Highlight.js"; the lowercasing was intentional.
@Sonic [2/2] As for the name, it's a library vs. project name issue (oh, I hate those projects called after the library, especially if the authors can't decide on official consistent variant...). If you take a look at Highlight.js readme you'll see that they mostly use the upper-case variant, even in a middle of a sentence. Library name is appropriate when referencing the file, while here it's being referenced as a project. And even then the real name of the library used by Stack Exchange is highlightjs-loader.en.js, not highlight.js.
@EvgenKo423 I wasn't aware of the convention at the time I wrote the answer. The editor who added that text initially and I were going off the project's website, which uses the lowercase name. Also, I did test the highlighter's behavior and it indeed doesn't highlight if none of the tags have identifiers specified; I thought things had changed since the linked question was posted, since a then-moderator in 2014 edited in the text here that they're automatically parsed.
@SamuelMuldoon That use case (using a tag name instead of a lang- specifier) is covered a few times; first under the "How do I use syntax highlighting?" heading, and then again under "Hinting: Tags".
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
complete the sentence: my question is about...
use tags that describe things or concepts that are essential, not incidental to your question
lang-
prefix isn't redundant. As mentioned in the post above,```lang-javascript
tells the highlighter to use the JS highlighter directly, while```javascript
alone tells it to look at the highlighter set for the tag [javascript]. They aren't always the same (maybe most notably with [typescript] on Stack Overflow).lang-default
is used, I'd like to know which language highlight.js ultimately settled on based on the auto-recognition (since if I find one I like, I can manually specify it in future, aslang-default
gives different results question to question even if I use the same language).highlightjs-loader.en.js
, nothighlight.js
.lang-
specifier) is covered a few times; first under the "How do I use syntax highlighting?" heading, and then again under "Hinting: Tags".