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

Function stretchy_encloseSpan

static/katex/katex.js:7406–7457  ·  view source on GitHub ↗
(inner, label, pad, options)

Source from the content-addressed store, hash-verified

7404};
7405
7406var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) {
7407 // Return an image span for \cancel, \bcancel, \xcancel, or \fbox
7408 var img;
7409 var totalHeight = inner.height + inner.depth + 2 * pad;
7410
7411 if (/fbox|color/.test(label)) {
7412 img = buildCommon.makeSpan(["stretchy", label], [], options);
7413
7414 if (label === "fbox") {
7415 var color = options.color && options.getColor();
7416
7417 if (color) {
7418 img.style.borderColor = color;
7419 }
7420 }
7421 } else {
7422 // \cancel, \bcancel, or \xcancel
7423 // Since \cancel's SVG is inline and it omits the viewBox attribute,
7424 // its stroke-width will not vary with span area.
7425 var lines = [];
7426
7427 if (/^[bx]cancel$/.test(label)) {
7428 lines.push(new LineNode({
7429 "x1": "0",
7430 "y1": "0",
7431 "x2": "100%",
7432 "y2": "100%",
7433 "stroke-width": "0.046em"
7434 }));
7435 }
7436
7437 if (/^x?cancel$/.test(label)) {
7438 lines.push(new LineNode({
7439 "x1": "0",
7440 "y1": "100%",
7441 "x2": "100%",
7442 "y2": "0",
7443 "stroke-width": "0.046em"
7444 }));
7445 }
7446
7447 var svgNode = new SvgNode(lines, {
7448 "width": "100%",
7449 "height": totalHeight + "em"
7450 });
7451 img = buildCommon.makeSvgSpan([], [svgNode], options);
7452 }
7453
7454 img.height = totalHeight;
7455 img.style.height = totalHeight + "em";
7456 return img;
7457};
7458
7459/* harmony default export */ var stretchy = ({
7460 encloseSpan: stretchy_encloseSpan,

Callers

nothing calls this directly

Calls 1

getColorMethod · 0.80

Tested by

no test coverage detected