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
CSScss-Strings and comments protect inner syntax
DiffdiffpatchMetadata, inserted, and deleted lines
DockerfiledockerfiledockerCommon directives, variables, commands
EJSejs-HTML plus optional JavaScript delegation
EnvenvdotenvProperties, values, comments
HTMLhtmlhtm, xml, angular-htmlOptional JavaScript/TypeScript and CSS delegation
HTTPhttp-Methods, headers, protocol, paths
JavaScriptjsjavascript, mjs, cjs, js-vueTemplates, interpolation, regex literals
JSONjsonjsonc, json5Properties, comments, strings, literals
JSXjsx-JavaScript plus contextual JSX tags
MarkdownmarkdownmdOptional fenced-language delegation
Mermaidmermaid-Common diagram declarations and arrows
Nginxnginx-Directives, variables, URLs, comments
Plaintextplaintexttext, txt, -->Escaping only
PythonpythonpyTriple strings, prefixes, decorators, comments
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
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.