Scope Reference

Stylable Scopes

The general purpose scopes are intended to be used for any language, but the other scopes may also be used when semantically correct. For example if you had a general purpose language that allowed inline URLs:

var GOOGLE =

It would be reasonable to use the link class for this, even if your language is not a markup language. However, many themes might not be designed with this in mind so a better choice (for best theme support) might possibly be string.

General purpose
keywordkeyword in a regular Algol-style language
built_inbuilt-in or library object (constant, class, function)
typedata type (in a language with syntactically significant types) (string, int, array, etc.)
literalspecial identifier for a built-in value (true, false, null, etc.)
numbernumber, including units and modifiers, if any.
operatoroperators: +, -, >>, |, ==
punctuationaux. punctuation that should be subtly highlighted (parentheses, brackets, etc.)
propertyobject property obj.prop1.prop2.value
regexpliteral regular expression
stringliteral string, character
char.escapean escape character such as \n
substparsed section inside a literal string
symbolsymbolic constant, interned string, goto label
classdeprecated You probably want title.class
functiondeprecated You probably want title.function
variable.languagevariable with special meaning in a language, e.g.: this, window, super, self, etc.
variable.constantvariable that is a constant value, ie MAX_FILES
titlename of a class or a function
title.classname of a class (interface, trait, module, etc)
title.class.inheritedname of class being inherited from, extended, etc.
title.functionname of a function
title.function.invokename of a function (when being invoked)
paramsblock of function arguments (parameters) at the place of declaration
doctagdocumentation markup within comments, e.g. @params
metaflags, modifiers, annotations, processing instructions, preprocessor directives, etc
meta.promptREPL or shell prompts or similar
meta keyworda keyword inside a meta block (note this is nested, not subscoped)
meta stringa string inside a meta block (note this is nested, not subscoped)
Tags, attributes, configs
sectionheading of a section in a config file, heading in text markup
tagXML/HTML tag
namename of an XML tag, the first word in an s-expression
attrname of an attribute with no language defined semantics (keys in JSON, setting names in .ini), also sub-attribute within another highlighted object, like XML tag
attributename of an attribute followed by a structured value part, like CSS properties
Text Markup
bulletlist item bullet
codecode block
strongstrong emphasis
formulamathematical formula
quotequotation or blockquote
selector-tagtag selector
selector-id#id selector
selector-class.class selector
selector-attr[attr] selector
selector-pseudo:pseudo selector
template-tagtag of a template language
template-variablevariable in a template language
additionadded or changed line
deletiondeleted line
A note on scopes with sub-scopes

Some scope names above have a . in them. We use this notation to specify sub-scopes. In the generated HTML this will output multiple computed class names. The depth of nesting determines the number of underscores appended to sub-scope names. For example, Lets say the scope is title.class.other.

The CSS class names generated would be:

  • hljs-title
  • class_
  • other__

The top-level scope is always the one that has the configured prefix applied.

The generated HTML would be:

<span class="hljs-title class_ other__">Render</span>

A theme could then simply target that using the following CSS:

.hljs-title.class_.other__ {
   color: blue;
A note on newer scopes

Some scopes have been added more recently and do not enjoy universal theme support. For themes without support, these items will simply not be highlighted. This doesn’t mean not to use them, only that they will be highlighted better as support improves over time.

A list of these scopes:

  • operator
  • punctuation
  • property
Reserved scopes

The below scopes (ReasonML) are left here for documentation purposes but may not be used in other grammars because they are very poorly supported by all themes.

If you’d like to help out with the larger issue here:

pattern-matchpattern matching matchers
typingtype signatures on function parameters
constructortype constructors
module-accessscope access into a module
modulemodule reference within scope access

Language names and aliases

The language names and aliases table has moved to