Skip to content

createTokenClassName

function createTokenClassName(prefix): (category) => string;

Defined in: packages/engine/src/language/tokenClassName.ts:53

Builds a tokenClassName bound to a fixed prefix.

The prefix is configurable because a host may already own a namespace it wants these classes to sit inside: a CodeMirror theme that keys off cm-, a design system that scopes everything under one token, or an app that embeds two editors and wants to style them apart. Passing the prefix once here is cheaper than threading it through every call site.

const className = createTokenClassName("cm-solve-");
className("number"); // "cm-solve-number"
ParameterTypeDescription
prefixstringNamespace to apply to every category.

A function mapping a category to a prefixed class name.

(category) => string