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

Function buildCommon_tryCombineChars

static/katex/katex.js:5557–5576  ·  view source on GitHub ↗
(chars)

Source from the content-addressed store, hash-verified

5555
5556
5557var buildCommon_tryCombineChars = function tryCombineChars(chars) {
5558 for (var i = 0; i < chars.length - 1; i++) {
5559 var prev = chars[i];
5560 var next = chars[i + 1];
5561
5562 if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) {
5563 prev.text += next.text;
5564 prev.height = Math.max(prev.height, next.height);
5565 prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use
5566 // it to add padding to the right of the span created from
5567 // the combined characters.
5568
5569 prev.italic = next.italic;
5570 chars.splice(i + 1, 1);
5571 i--;
5572 }
5573 }
5574
5575 return chars;
5576};
5577/**
5578 * Calculate the height, depth, and maxFontSize of an element based on its
5579 * children.

Callers

nothing calls this directly

Calls 1

buildCommon_canCombineFunction · 0.85

Tested by

no test coverage detected