tokenClassName
function tokenClassName(category, prefix?): string;Defined in: packages/engine/src/language/tokenClassName.ts:32
Maps a semantic category to a predictable, stable CSS class name.
Deliberately trivial: the category name IS the class-name key
("number" → solve-number), so there is no separate table to keep in
sync as categories grow. A brand-new category, including one contributed
by a solve-js package at runtime, gets a matching class name with no
changes here.
This is editor-agnostic on purpose. It produces a class-name string and
nothing else, so it works the same whether the host is CodeMirror
(Decoration.mark({ class: tokenClassName(token.category) })), Slate,
ProseMirror, Monaco or a plain <span>. Actual colors are pure CSS,
resolved from --solve-hl-{category} custom properties by each consumer.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
category | TokenCategory | undefined | Semantic category from getSemanticTokens(). |
prefix | string | DEFAULT_TOKEN_CLASS_PREFIX | Namespace to apply. Defaults to solve-. |
Returns
Section titled “Returns”string
The class name for that category.