A world-class math input for the web
at main 17 lines 416 B view raw
1import { CaretNode, h, t, VNode } from "@caret-js/core"; 2import { MathExpressionTag } from "../tags/mathExpression"; 3 4export class VariableNode extends CaretNode { 5 constructor(public name: string) { 6 super(); 7 this.addTag(new MathExpressionTag()); 8 } 9 10 static from(name: string): VariableNode { 11 return new VariableNode(name); 12 } 13 14 toDebugMathML(): VNode { 15 return h("mi", {}, t(this.name)); 16 } 17}