MCPcopy
hub / github.com/KaTeX/KaTeX / PathNode

Class PathNode

src/domTree.ts:545–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545export class PathNode implements VirtualNode {
546 pathName: string;
547 alternate: string | null | undefined;
548
549 constructor(pathName: string, alternate?: string) {
550 this.pathName = pathName;
551 this.alternate = alternate; // Used only for \sqrt, \phase, & tall delims
552 }
553
554 toNode(): Node {
555 const svgNS = "http://www.w3.org/2000/svg";
556 const node = document.createElementNS(svgNS, "path");
557
558 if (this.alternate) {
559 node.setAttribute("d", this.alternate);
560 } else {
561 node.setAttribute("d", path[this.pathName]);
562 }
563
564 return node;
565 }
566
567 toMarkup(): string {
568 if (this.alternate) {
569 return `<path d="${escape(this.alternate)}"/>`;
570 } else {
571 return `<path d="${escape(path[this.pathName])}"/>`;
572 }
573 }
574}
575
576export class LineNode implements VirtualNode {
577 attributes: Record<string, string>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…