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

Function sqrtSvg

static/katex/katex.mjs:8266–8290  ·  view source on GitHub ↗
(sqrtName, height, viewBoxHeight, options)

Source from the content-addressed store, hash-verified

8264const emPad = 0.08; // padding, in ems, measured in the document.
8265
8266const sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, options) {
8267 let alternate;
8268
8269 if (sqrtName === "sqrtTall") {
8270 // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
8271 // One path edge has a variable length. It runs from the viniculumn
8272 // to a point near (14 units) the bottom of the surd. The viniculum
8273 // is 40 units thick. So the length of the line in question is:
8274 const vertSegment = viewBoxHeight - 54 - vbPad;
8275 alternate = `M702 ${vbPad}H400000v40H742v${vertSegment}l-4 4-4 4c-.667.7
8276-2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667
8277-294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155
8278 77-156c66 199.333 139 419.667 219 661 l218 661zM702 ${vbPad}H400000v40H742z`;
8279 }
8280
8281 const pathNode = new PathNode(sqrtName, alternate);
8282 const svg = new SvgNode([pathNode], {
8283 // Note: 1000:1 ratio of viewBox to document em width.
8284 "width": "400em",
8285 "height": height + "em",
8286 "viewBox": "0 0 400000 " + viewBoxHeight,
8287 "preserveAspectRatio": "xMinYMin slice"
8288 });
8289 return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
8290};
8291/**
8292 * Make a sqrt image of the given height,
8293 */

Callers 1

makeSqrtImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected