MCPcopy Create free account
hub / github.com/TruthHun/BookStack / tryCombineChars

Function tryCombineChars

static/katex/katex.mjs:5528–5547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5526
5527
5528const tryCombineChars = chars => {
5529 for (let i = 0; i < chars.length - 1; i++) {
5530 const prev = chars[i];
5531 const next = chars[i + 1];
5532
5533 if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) {
5534 prev.text += next.text;
5535 prev.height = Math.max(prev.height, next.height);
5536 prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use
5537 // it to add padding to the right of the span created from
5538 // the combined characters.
5539
5540 prev.italic = next.italic;
5541 chars.splice(i + 1, 1);
5542 i--;
5543 }
5544 }
5545
5546 return chars;
5547};
5548/**
5549 * Calculate the height, depth, and maxFontSize of an element based on its
5550 * children.

Callers

nothing calls this directly

Calls 1

canCombineFunction · 0.85

Tested by

no test coverage detected