You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default registry contains 27 languages. Pass the identifier in the
Identifier column to Highlighter::highlight().
Identifiers are case-insensitive after trimming, but there are no short
aliases. Use javascript, not js; typescript, not ts; bash, not sh;
yaml, not yml; and csharp, not cs.
Any synthetic context required by PHP's native tokenizer is absent from the
returned stream, so text, byte offsets, lines, and columns describe the exact
source supplied by the caller.
The historical php-snippet identifier remains a compatibility alias for
php; it is not a 28th registered language. New code should use php.
Register a custom language
Custom parsers implement LanguageInterface and return a ParsedStream:
Registering an existing identifier replaces that parser on the highlighter
instance. Theme authors style the generic semantic scopes emitted by parsers;
see Creating a theme.
Extension contract
Custom parsers implement LanguageInterface and return a ParsedStream made
of ParsedToken values. StreamBuilder, TokenType, and Scope are
supported building blocks. Languages::getDefaultLanguages() returns the
built-in registry.
Embedded parsers use EmbeddedLanguageCapable, EmbeddedLanguageContext, and
the public types under Alto\Code\Highlight\Embedded. Their documented
constructors and methods follow the same compatibility promise described in
Compatibility.