TanStack
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
Apacheapache-Directives, tags, comments
CMakecmake-Bracket strings/comments, nested variables, generator expressions
C++cppc++, cc, cxx, hpp, hxxRaw and prefixed strings, character literals, preprocessor directives, digit separators
C#csharpc#, csVerbatim, interpolated, and raw strings with nested quotes, character literals, preprocessor directives, line-leading and parameter attributes, contextual and LINQ keywords
CSScss-Strings and comments protect inner syntax
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
EnvenvdotenvProperties, values, comments
GogogolangRaw strings, runes, comments, declarations
HTMLhtmlhtm, xml, angular-htmlOptional JavaScript/TypeScript and CSS delegation
HTTPhttp-Methods, headers, protocol, paths
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
Kotlinkotlinkt, ktsString templates with nested quotes and braces, raw strings, nested block comments, annotations vs labels, backticked names, contextual soft keywords and accessors
Lualua-Level-matched long-bracket strings and comments, string escapes, Luau backtick strings, shebang lines, paren-less calls, LuaJIT number suffixes
MarkdownmarkdownmdOptional fenced-language delegation
Mermaidmermaid-Common diagram declarations and arrows
Nginxnginx-Directives, variables, URLs, comments
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
PythonpythonpyTriple strings, prefixes, decorators, 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
Schemeschemescm, racketComments, strings, forms, literals
Shellshellbash, sh, zsh, cmd, consoleHeredocs, parameter expansion, comment boundaries
SQLsql-Strings, comments, common SQL clauses
Sveltesvelte-Markup plus optional script/style and expression delegation
TOMLtoml-Strings, comments, tables, properties
TypeScripttstypescript, angular-tsJavaScript scanner plus TypeScript keywords/types
TSRXtsrxoctaneTypeScript, contextual JSX, Octane component shorthand and template directives
TSXtsx-TypeScript, contextual JSX, generic disambiguation
Vuevue-Template markup plus optional script/style delegation
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

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.