Skip to content
Project

Language Support

Language Support

Every language is an isolated definition imported from @tanstack/highlight/languages/<name>. Aliases normalize only when their target definition is registered.

Language matrix

LanguageExportAliasesContext-aware behavior
AdaadaNoneDoubled quotes, character literals, case-insensitive keywords
Apacheapache-Directives, tags, comments
AppleScriptapplescriptosascriptNested block comments, strings, case-insensitive keywords
AWKawkNoneFields, strings, regex patterns following ~, keywords and comments
Batchbatchbat, dosREM comments, variables, quoted strings, control keywords
CchPreprocessor directives, strings, character literals, types
C#csharpc#, csVerbatim, interpolated, and raw strings with nested quotes, character literals, preprocessor directives, line-leading and parameter attributes, contextual and LINQ keywords
C++cppc++, cc, cxx, hpp, hxxRaw and prefixed strings, character literals, preprocessor directives, digit separators
Clojureclojureclj, ednForms, strings, keyword symbols, line comments
CMakecmake-Bracket strings/comments, nested variables, generator expressions
CoffeeScriptcoffeescriptcoffee, csonBlock comments, triple-quoted strings, keywords and literals
Common Lisplispcommonlisp, clForms, keyword symbols, nested comments, strings
CrystalcrystalcrDeclarations, quoted strings, line comments
CSScss-Strings and comments protect inner syntax
DdNoneNested /+ comments, backtick strings, declarations
Dartdart-Interpolated strings with nested quotes and braces, triple-quoted and raw strings, nested block comments, annotations, named-argument labels, contextual keywords
DiffdiffpatchMetadata, inserted, and deleted lines
DockerfiledockerfiledockerCommon directives, variables, commands
EJSejs-HTML plus optional JavaScript delegation
Elixirelixirex, exsDeclarations, atoms, quoted and triple-quoted strings
ElmelmNoneNested block comments, strings, keywords
EnvenvdotenvProperties, values, comments
ErlangerlangerlDirectives, variables, strings, keywords
F#fsharpfs, f#, fsxNested comments, verbatim and triple-quoted strings, character literals
Fortranfortranf90, f95, f03, f08Free-form comments, doubled quotes, case-insensitive keywords
GLSLglslNonePreprocessor directives, qualifiers, types, comments
GogogolangRaw strings, runes, comments, declarations
GraphQLgraphqlgqlBlock descriptions, variables, directives, schema and operation keywords
GroovygroovyNoneDeclarations, quoted and triple-quoted strings, comments
HaskellhaskellhsNested comments, character literals, strings, keywords
HTMLhtmlhtm, xml, angular-htmlOptional JavaScript/TypeScript and CSS delegation
HTTPhttp-Methods, headers, protocol, paths
INIinicfgSections, properties, quoted values, comments
Java propertiespropertiesjava-propertiesKeys, simple values, escaped key separators and comments
Javajava-Text blocks, character literals, annotations, contextual keywords, digit separators and hex floats
JavaScriptjsjavascript, mjs, cjs, js-vueTemplates, interpolation, regex literals
JSONjsonjsonc, json5Properties, comments, strings, literals
JSXjsx-JavaScript plus contextual JSX tags
JuliajuliajlNested comments, triple-quoted strings, character literals, keywords
Kotlinkotlinkt, ktsString templates with nested quotes and braces, raw strings, nested block comments, annotations vs labels, backticked names, contextual soft keywords and accessors
LaTeXlatextexCommands, comments, pipe- and plus-delimited verbatim spans
LesslessNoneVariables, selectors, properties, strings and comments
Lualua-Level-matched long-bracket strings and comments, string escapes, Luau backtick strings, shebang lines, paren-less calls, LuaJIT number suffixes
Makefilemakefilemake, mk, makTargets, assignments, variable references, comments
MarkdownmarkdownmdOptional fenced-language delegation
MATLABmatlabNoneLine and block comments, doubled quotes, common transpose boundaries
Mermaidmermaid-Common diagram declarations and arrows
Nginxnginx-Directives, variables, URLs, comments
NixnixnixosIndented and quoted strings, comments, keywords
Objective-Cobjectivecobjc, obj-c, objective-c, mmAt-prefixed declarations and strings, preprocessor directives
OCamlocamlmlNested comments, strings, character literals, type-variable boundaries
Pascal / Delphipascalpas, delphi, dprBrace and block comments, doubled apostrophes, case-insensitive keywords
PerlperlplSigil and special variables, quote-like operators with nested delimiters, regex vs division, heredocs, POD blocks
PHPphp-PHP tags, attributes, quoted strings, heredoc/nowdoc, optional HTML delegation
Plaintextplaintexttext, txt, -->Escaping only
PowerShellpowershellpwsh, ps1, psHere-strings, variables, commands, block comments
Protocol BuffersprotobufprotoMessage and service declarations, scalar types, comments
PythonpythonpyTriple strings, prefixes, decorators, comments
RrNoneStrings, backtick names, literals, comments
RubyrubyrbInterpolated strings with nested quotes, percent literals, heredocs, regex vs division, symbols and hash keys, block comments
RustrustrsNested block comments, raw strings with hash counts, byte and C strings, lifetimes vs character literals, attributes, macros
ScalascalascNested comments, quoted and triple-quoted strings, declarations
Schemeschemescm, racketComments, strings, forms, literals
SCSSscssNoneVariables, directives, selectors, properties, strings and comments
Shellshellbash, sh, zsh, cmd, consoleHeredocs, parameter expansion, comment boundaries
SQLsql-Strings, comments, common SQL clauses
Sveltesvelte-Markup plus optional script/style and expression delegation
Swiftswift-Interpolated, multi-line, and raw strings with nested quotes, regex literals vs division, nested block comments, contextual keywords, attributes and directives
TOMLtoml-Strings, comments, tables, properties
TSRXtsrxoctaneTypeScript, contextual JSX, Octane component shorthand and template directives
TSXtsx-TypeScript, contextual JSX, generic disambiguation
TypeScripttstypescript, angular-tsJavaScript scanner plus TypeScript keywords/types
Verilog / SystemVerilogverilogv, sv, svhDirectives, sized numeric literals, keywords and comments
VHDLvhdlNoneStrings, character literals, case-insensitive keywords, comments
Visual Basic .NETvbnetvbDoubled quotes, apostrophe and REM comments, case-insensitive keywords
Vuevue-Template markup plus optional script/style delegation
WebAssembly textwatwasmNested comments, named variables, instructions and strings
x86 assemblyx86asmasm, nasmCommon instructions and registers, labels, directives and comments
YAMLyamlymlComment boundaries and block scalars

Registration matters

ts
import { createHighlighter } from '@tanstack/highlight/core'
import { html } from '@tanstack/highlight/languages/html'

const markupOnly = createHighlighter({ languages: [html] })

markupOnly highlights tags and attributes, but leaves <script> and <style> bodies uncolored. Add the delegated languages explicitly:

ts
import { css } from '@tanstack/highlight/languages/css'
import { js } from '@tanstack/highlight/languages/js'

const withEmbeddings = createHighlighter({
  languages: [html, css, js],
})

Quality boundary

The 40 added definitions from Ada through WebAssembly text provide lexical highlighting for common documentation examples. They share a small scanner and carry only their own vocabulary. They do not include the Highlight.js runtime or its complete grammars.

Expressions inside strings are not tokenized separately in these definitions. Language-specific sigils, heredocs outside PowerShell, regex literals outside AWK's ~ form, macro bodies, and embedded languages are not fully parsed. Fortran covers free-form code; the assembly definition covers common x86 instructions. Existing definitions with deeper interpolation or embedding support retain that behavior.

The existing cmd alias continues to resolve to shell. Use batch, bat, or dos to select the new Windows Batch definition.

Support means useful highlighting for valid code commonly found in documentation. It does not mean compiler conformance or parity with an IDE grammar. The regression suite concentrates on contexts where simple priority regexes are predictably wrong.

Unknown or unregistered language names normalize to the configured fallback, which defaults to plaintext.

See Embedded Languages and Custom Languages for the registry model.