MCPcopy
hub / github.com/KaTeX/KaTeX / defineFunction

Function defineFunction

src/defineFunction.ts:169–190  ·  view source on GitHub ↗
(
    data: FunctionDefSpec<NODETYPE, NAMES>,
)

Source from the content-addressed store, hash-verified

167export const _mathmlGroupBuilders: Record<string, MathMLBuilder<any>> = {};
168
169export default function defineFunction<
170 NODETYPE extends NodeType,
171 const NAMES extends readonly string[],
172>(
173 data: FunctionDefSpec<NODETYPE, NAMES>,
174) {
175 const {type, names, htmlBuilder, mathmlBuilder} = data;
176 for (let i = 0; i < names.length; ++i) {
177 // To avoid destructuring and rebuilding an object,
178 // we store the entire FunctionDefSpec object,
179 // even though Parser only needs the FunctionSpec fields.
180 _functions[names[i]] = data;
181 }
182 if (type) {
183 if (htmlBuilder) {
184 _htmlGroupBuilders[type] = htmlBuilder;
185 }
186 if (mathmlBuilder) {
187 _mathmlGroupBuilders[type] = mathmlBuilder;
188 }
189 }
190}
191
192/**
193 * Use this to register only the HTML and MathML builders for a function (e.g.

Callers 15

array.tsFile · 0.85
cd.tsFile · 0.85
text.tsFile · 0.85
sqrt.tsFile · 0.85
pmb.tsFile · 0.85
html.tsFile · 0.85
phantom.tsFile · 0.85
href.tsFile · 0.85
relax.tsFile · 0.85
delimsizing.tsFile · 0.85
vcenter.tsFile · 0.85
enclose.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…