Version: @tanstack/highlight 0.0.9
When a JSX element's attributes span multiple lines, neither the tag name nor its attributes are classified — the tag name falls back to the Capitalized-identifier type class and the attributes come out plain (or property when they read like member access).
Repro
import { createHighlighter } from '@tanstack/highlight/core'
import { tsx } from '@tanstack/highlight/languages/tsx'
const h = createHighlighter({ languages: [tsx] })
const code = `<AriaLink
href={props.href}
render={({ ref }) => null}
/>`
console.log(h.tokenize(code, { lang: 'tsx' }).tokens)
Actual:
["<", ["AriaLink","type"], "\n href={props.", ["href","property"], "}\n render={({ ref }) => ", ["null","literal"], "}\n/>"]
AriaLink is classed type, not tag
href / render attribute names get no attr class
Single-line elements work as expected — <Input value={value} placeholder="x" /> produces tag + attr classes correctly, including for expression values. So the regression is specifically the newline inside the open tag.
Multiline formatting is what Prettier & co. emit for any element with more than a couple of attributes, so most real-world component snippets hit this.
Context: found while migrating dotui.org's docs from shiki, character-diffing both engines over our full corpus (~733k chars of tsx).
Version:
@tanstack/highlight0.0.9When a JSX element's attributes span multiple lines, neither the tag name nor its attributes are classified — the tag name falls back to the Capitalized-identifier
typeclass and the attributes come out plain (orpropertywhen they read like member access).Repro
Actual:
AriaLinkis classedtype, nottaghref/renderattribute names get noattrclassSingle-line elements work as expected —
<Input value={value} placeholder="x" />producestag+attrclasses correctly, including for expression values. So the regression is specifically the newline inside the open tag.Multiline formatting is what Prettier & co. emit for any element with more than a couple of attributes, so most real-world component snippets hit this.
Context: found while migrating dotui.org's docs from shiki, character-diffing both engines over our full corpus (~733k chars of tsx).