MCPcopy
hub / github.com/KaTeX/KaTeX / TextNode

Class TextNode

src/mathMLTree.ts:155–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153 * This node represents a piece of text.
154 */
155export class TextNode implements MathDomNode {
156 text: string;
157
158 constructor(text: string) {
159 this.text = text;
160 }
161
162 /**
163 * Converts the text node into a DOM text node.
164 */
165 toNode(): Node {
166 return document.createTextNode(this.text);
167 }
168
169 /**
170 * Converts the text node into escaped HTML markup
171 * (representing the text itself).
172 */
173 toMarkup(): string {
174 return escape(this.toText());
175 }
176
177 /**
178 * Converts the text node into a string
179 * (representing the text itself).
180 */
181 toText(): string {
182 return this.text;
183 }
184}
185
186/**
187 * This node represents a space, but may render as <mspace.../> or as text,

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…