MCPcopy
hub / github.com/KaTeX/KaTeX / formatUnsupportedCmd

Method formatUnsupportedCmd

src/Parser.ts:313–333  ·  view source on GitHub ↗

* Converts the textual input of an unsupported command into a text node * contained within a color node whose color is determined by errorColor

(text: string)

Source from the content-addressed store, hash-verified

311 * contained within a color node whose color is determined by errorColor
312 */
313 formatUnsupportedCmd(text: string): UnsupportedCmdParseNode {
314 const textordArray: ParseNode<"textord">[] = [];
315
316 for (let i = 0; i < text.length; i++) {
317 textordArray.push({type: "textord", mode: "text", text: text[i]});
318 }
319
320 const textNode: ParseNode<"text"> = {
321 type: "text",
322 mode: this.mode,
323 body: textordArray,
324 };
325 const colorNode: ParseNode<"color"> = {
326 type: "color",
327 mode: this.mode,
328 color: this.settings.errorColor,
329 body: [textNode],
330 };
331
332 return colorNode;
333 }
334
335 /**
336 * Parses a group with optional super/subscripts.

Callers 4

parseGroupMethod · 0.95
html.tsFile · 0.80
href.tsFile · 0.80
includegraphics.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected