A world-class math input for the web
1import { CaretNode, h, VNode } from "@caret-js/core";
2import { MathExpressionTag } from "../tags/mathExpression";
3
4export class SubscriptNode extends CaretNode {
5 constructor(public child: CaretNode, public subscript: CaretNode) {
6 super();
7 this.addTag(new MathExpressionTag());
8 }
9
10 static from(child: CaretNode, subscript: CaretNode): SubscriptNode {
11 return new SubscriptNode(child, subscript);
12 }
13
14 toDebugMathML(): VNode {
15 return h(
16 "msub",
17 {},
18 this.child.toDebugMathML(),
19 this.subscript.toDebugMathML()
20 );
21 }
22}