katex 0.10.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +141 -0
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/cli.js +0 -0
- package/contrib/auto-render/auto-render.js +12 -3
- package/contrib/copy-tex/README.md +3 -5
- package/contrib/mathtex-script-type/README.md +12 -14
- package/contrib/mhchem/README.md +3 -1
- package/contrib/render-a11y-string/render-a11y-string.js +712 -0
- package/contrib/render-a11y-string/test/render-a11y-string-spec.js +526 -0
- package/dist/README.md +6 -6
- package/dist/contrib/auto-render.js +14 -3
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +14 -3
- package/dist/contrib/mhchem.min.js +1 -1
- package/dist/contrib/render-a11y-string.js +870 -0
- package/dist/contrib/render-a11y-string.min.js +1 -0
- package/dist/contrib/render-a11y-string.mjs +753 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +34 -10
- package/dist/katex.js +2906 -2115
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +2809 -2020
- package/package.json +12 -11
- package/src/Lexer.js +1 -0
- package/src/MacroExpander.js +39 -10
- package/src/Options.js +15 -75
- package/src/Parser.js +152 -115
- package/src/Settings.js +70 -7
- package/src/Token.js +2 -0
- package/src/buildCommon.js +24 -90
- package/src/buildHTML.js +31 -31
- package/src/buildMathML.js +52 -9
- package/src/buildTree.js +13 -6
- package/src/defineFunction.js +7 -22
- package/src/delimiter.js +66 -27
- package/src/domTree.js +71 -4
- package/src/environments/array.js +235 -25
- package/src/fontMetrics.js +11 -2
- package/src/functions/accent.js +9 -9
- package/src/functions/accentunder.js +2 -2
- package/src/functions/arrow.js +15 -5
- package/src/functions/color.js +9 -38
- package/src/functions/def.js +184 -0
- package/src/functions/delimsizing.js +32 -8
- package/src/functions/enclose.js +33 -6
- package/src/functions/font.js +4 -1
- package/src/functions/genfrac.js +39 -27
- package/src/functions/horizBrace.js +6 -7
- package/src/functions/href.js +16 -0
- package/src/functions/html.js +102 -0
- package/src/functions/includegraphics.js +153 -0
- package/src/functions/lap.js +4 -7
- package/src/functions/math.js +1 -5
- package/src/functions/mclass.js +41 -2
- package/src/functions/op.js +27 -111
- package/src/functions/operatorname.js +136 -92
- package/src/functions/ordgroup.js +1 -1
- package/src/functions/overline.js +3 -2
- package/src/functions/phantom.js +5 -2
- package/src/functions/raisebox.js +4 -16
- package/src/functions/rule.js +20 -9
- package/src/functions/styling.js +0 -9
- package/src/functions/supsub.js +27 -7
- package/src/functions/symbolsOp.js +4 -0
- package/src/functions/tag.js +20 -4
- package/src/functions/text.js +4 -3
- package/src/functions/underline.js +3 -2
- package/src/functions/utils/assembleSupSub.js +110 -0
- package/src/functions.js +3 -0
- package/src/katex.less +45 -9
- package/src/macros.js +259 -98
- package/src/mathMLTree.js +6 -4
- package/src/parseNode.js +37 -57
- package/src/stretchy.js +3 -1
- package/src/svgGeometry.js +136 -44
- package/src/symbols.js +52 -69
- package/src/tree.js +2 -2
- package/src/types.js +2 -1
- package/src/unicodeAccents.js +3 -1
- package/src/unicodeSymbols.js +30 -321
- package/src/utils.js +10 -0
- package/src/wide-character.js +2 -2
- package/src/unicodeMake.js +0 -70
package/src/macros.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import fontMetricsData from "../submodules/katex-fonts/fontMetricsData";
|
|
8
|
+
import functions from "./functions";
|
|
8
9
|
import symbols from "./symbols";
|
|
9
10
|
import utils from "./utils";
|
|
10
11
|
import {Token} from "./Token";
|
|
@@ -36,6 +37,16 @@ export interface MacroContextInterface {
|
|
|
36
37
|
*/
|
|
37
38
|
popToken(): Token;
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Consume all following space tokens, without expansion.
|
|
42
|
+
*/
|
|
43
|
+
consumeSpaces(): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Expand the next token only once if possible.
|
|
47
|
+
*/
|
|
48
|
+
expandOnce(expandableOnly?: boolean): Token | Token[];
|
|
49
|
+
|
|
39
50
|
/**
|
|
40
51
|
* Expand the next token only once (if possible), and return the resulting
|
|
41
52
|
* top token on the stack (without removing anything from the stack).
|
|
@@ -73,10 +84,19 @@ export interface MacroContextInterface {
|
|
|
73
84
|
* `implicitCommands`.
|
|
74
85
|
*/
|
|
75
86
|
isDefined(name: string): boolean;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Determine whether a command is expandable.
|
|
90
|
+
*/
|
|
91
|
+
isExpandable(name: string): boolean;
|
|
76
92
|
}
|
|
77
93
|
|
|
78
94
|
/** Macro tokens (in reverse order). */
|
|
79
|
-
export type MacroExpansion = {
|
|
95
|
+
export type MacroExpansion = {
|
|
96
|
+
tokens: Token[],
|
|
97
|
+
numArgs: number,
|
|
98
|
+
unexpandable?: boolean, // used in \let
|
|
99
|
+
};
|
|
80
100
|
|
|
81
101
|
export type MacroDefinition = string | MacroExpansion |
|
|
82
102
|
(MacroContextInterface => (string | MacroExpansion));
|
|
@@ -93,6 +113,29 @@ export function defineMacro(name: string, body: MacroDefinition) {
|
|
|
93
113
|
//////////////////////////////////////////////////////////////////////
|
|
94
114
|
// macro tools
|
|
95
115
|
|
|
116
|
+
defineMacro("\\noexpand", function(context) {
|
|
117
|
+
// The expansion is the token itself; but that token is interpreted
|
|
118
|
+
// as if its meaning were ‘\relax’ if it is a control sequence that
|
|
119
|
+
// would ordinarily be expanded by TeX’s expansion rules.
|
|
120
|
+
const t = context.popToken();
|
|
121
|
+
if (context.isExpandable(t.text)) {
|
|
122
|
+
t.noexpand = true;
|
|
123
|
+
t.treatAsRelax = true;
|
|
124
|
+
}
|
|
125
|
+
return {tokens: [t], numArgs: 0};
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
defineMacro("\\expandafter", function(context) {
|
|
129
|
+
// TeX first reads the token that comes immediately after \expandafter,
|
|
130
|
+
// without expanding it; let’s call this token t. Then TeX reads the
|
|
131
|
+
// token that comes after t (and possibly more tokens, if that token
|
|
132
|
+
// has an argument), replacing it by its expansion. Finally TeX puts
|
|
133
|
+
// t back in front of that expansion.
|
|
134
|
+
const t = context.popToken();
|
|
135
|
+
context.expandOnce(true); // expand only an expandable token
|
|
136
|
+
return {tokens: [t], numArgs: 0};
|
|
137
|
+
});
|
|
138
|
+
|
|
96
139
|
// LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2
|
|
97
140
|
// TeX source: \long\def\@firstoftwo#1#2{#1}
|
|
98
141
|
defineMacro("\\@firstoftwo", function(context) {
|
|
@@ -108,10 +151,12 @@ defineMacro("\\@secondoftwo", function(context) {
|
|
|
108
151
|
});
|
|
109
152
|
|
|
110
153
|
// LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)
|
|
111
|
-
// symbol
|
|
112
|
-
//
|
|
154
|
+
// symbol that isn't a space, consuming any spaces but not consuming the
|
|
155
|
+
// first nonspace character. If that nonspace character matches #1, then
|
|
156
|
+
// the macro expands to #2; otherwise, it expands to #3.
|
|
113
157
|
defineMacro("\\@ifnextchar", function(context) {
|
|
114
158
|
const args = context.consumeArgs(3); // symbol, if, else
|
|
159
|
+
context.consumeSpaces();
|
|
115
160
|
const nextToken = context.future();
|
|
116
161
|
if (args[0].length === 1 && args[0][0].text === nextToken.text) {
|
|
117
162
|
return {tokens: args[1], numArgs: 0};
|
|
@@ -191,59 +236,6 @@ defineMacro("\\char", function(context) {
|
|
|
191
236
|
return `\\@char{${number}}`;
|
|
192
237
|
});
|
|
193
238
|
|
|
194
|
-
// Basic support for macro definitions:
|
|
195
|
-
// \def\macro{expansion}
|
|
196
|
-
// \def\macro#1{expansion}
|
|
197
|
-
// \def\macro#1#2{expansion}
|
|
198
|
-
// \def\macro#1#2#3#4#5#6#7#8#9{expansion}
|
|
199
|
-
// Also the \gdef and \global\def equivalents
|
|
200
|
-
const def = (context, global: boolean) => {
|
|
201
|
-
let arg = context.consumeArgs(1)[0];
|
|
202
|
-
if (arg.length !== 1) {
|
|
203
|
-
throw new ParseError("\\gdef's first argument must be a macro name");
|
|
204
|
-
}
|
|
205
|
-
const name = arg[0].text;
|
|
206
|
-
// Count argument specifiers, and check they are in the order #1 #2 ...
|
|
207
|
-
let numArgs = 0;
|
|
208
|
-
arg = context.consumeArgs(1)[0];
|
|
209
|
-
while (arg.length === 1 && arg[0].text === "#") {
|
|
210
|
-
arg = context.consumeArgs(1)[0];
|
|
211
|
-
if (arg.length !== 1) {
|
|
212
|
-
throw new ParseError(`Invalid argument number length "${arg.length}"`);
|
|
213
|
-
}
|
|
214
|
-
if (!(/^[1-9]$/.test(arg[0].text))) {
|
|
215
|
-
throw new ParseError(`Invalid argument number "${arg[0].text}"`);
|
|
216
|
-
}
|
|
217
|
-
numArgs++;
|
|
218
|
-
if (parseInt(arg[0].text) !== numArgs) {
|
|
219
|
-
throw new ParseError(`Argument number "${arg[0].text}" out of order`);
|
|
220
|
-
}
|
|
221
|
-
arg = context.consumeArgs(1)[0];
|
|
222
|
-
}
|
|
223
|
-
// Final arg is the expansion of the macro
|
|
224
|
-
context.macros.set(name, {
|
|
225
|
-
tokens: arg,
|
|
226
|
-
numArgs,
|
|
227
|
-
}, global);
|
|
228
|
-
return '';
|
|
229
|
-
};
|
|
230
|
-
defineMacro("\\gdef", (context) => def(context, true));
|
|
231
|
-
defineMacro("\\def", (context) => def(context, false));
|
|
232
|
-
defineMacro("\\global", (context) => {
|
|
233
|
-
const next = context.consumeArgs(1)[0];
|
|
234
|
-
if (next.length !== 1) {
|
|
235
|
-
throw new ParseError("Invalid command after \\global");
|
|
236
|
-
}
|
|
237
|
-
const command = next[0].text;
|
|
238
|
-
// TODO: Should expand command
|
|
239
|
-
if (command === "\\def") {
|
|
240
|
-
// \global\def is equivalent to \gdef
|
|
241
|
-
return def(context, true);
|
|
242
|
-
} else {
|
|
243
|
-
throw new ParseError(`Invalid command '${command}' after \\global`);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
|
|
247
239
|
// \newcommand{\macro}[args]{definition}
|
|
248
240
|
// \renewcommand{\macro}[args]{definition}
|
|
249
241
|
// TODO: Optional arguments: \newcommand{\macro}[args][default]{definition}
|
|
@@ -293,6 +285,28 @@ defineMacro("\\newcommand", (context) => newcommand(context, false, true));
|
|
|
293
285
|
defineMacro("\\renewcommand", (context) => newcommand(context, true, false));
|
|
294
286
|
defineMacro("\\providecommand", (context) => newcommand(context, true, true));
|
|
295
287
|
|
|
288
|
+
// terminal (console) tools
|
|
289
|
+
defineMacro("\\message", (context) => {
|
|
290
|
+
const arg = context.consumeArgs(1)[0];
|
|
291
|
+
// eslint-disable-next-line no-console
|
|
292
|
+
console.log(arg.reverse().map(token => token.text).join(""));
|
|
293
|
+
return '';
|
|
294
|
+
});
|
|
295
|
+
defineMacro("\\errmessage", (context) => {
|
|
296
|
+
const arg = context.consumeArgs(1)[0];
|
|
297
|
+
// eslint-disable-next-line no-console
|
|
298
|
+
console.error(arg.reverse().map(token => token.text).join(""));
|
|
299
|
+
return '';
|
|
300
|
+
});
|
|
301
|
+
defineMacro("\\show", (context) => {
|
|
302
|
+
const tok = context.popToken();
|
|
303
|
+
const name = tok.text;
|
|
304
|
+
// eslint-disable-next-line no-console
|
|
305
|
+
console.log(tok, context.macros.get(name), functions[name],
|
|
306
|
+
symbols.math[name], symbols.text[name]);
|
|
307
|
+
return '';
|
|
308
|
+
});
|
|
309
|
+
|
|
296
310
|
//////////////////////////////////////////////////////////////////////
|
|
297
311
|
// Grouping
|
|
298
312
|
// \let\bgroup={ \let\egroup=}
|
|
@@ -334,6 +348,9 @@ defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur
|
|
|
334
348
|
defineMacro("\u210C", "\\mathfrak{H}");
|
|
335
349
|
defineMacro("\u2128", "\\mathfrak{Z}");
|
|
336
350
|
|
|
351
|
+
// Define \Bbbk with a macro that works in both HTML and MathML.
|
|
352
|
+
defineMacro("\\Bbbk", "\\Bbb{k}");
|
|
353
|
+
|
|
337
354
|
// Unicode middle dot
|
|
338
355
|
// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
|
|
339
356
|
// the dot at U+22C5 and gives it punct spacing.
|
|
@@ -348,7 +365,8 @@ defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
|
|
|
348
365
|
// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
|
|
349
366
|
// It's thus treated like a \mathrel, but defined by a symbol that has zero
|
|
350
367
|
// width but extends to the right. We use \rlap to get that spacing.
|
|
351
|
-
|
|
368
|
+
// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
|
|
369
|
+
defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
|
|
352
370
|
|
|
353
371
|
// Negated symbols from base/fontmath.ltx:
|
|
354
372
|
// \def\neq{\not=} \let\ne=\neq
|
|
@@ -394,6 +412,13 @@ defineMacro("\u00A9", "\\copyright");
|
|
|
394
412
|
defineMacro("\u00AE", "\\textregistered");
|
|
395
413
|
defineMacro("\uFE0F", "\\textregistered");
|
|
396
414
|
|
|
415
|
+
// The KaTeX fonts have corners at codepoints that don't match Unicode.
|
|
416
|
+
// For MathML purposes, use the Unicode code point.
|
|
417
|
+
defineMacro("\\ulcorner", "\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}");
|
|
418
|
+
defineMacro("\\urcorner", "\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}");
|
|
419
|
+
defineMacro("\\llcorner", "\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}");
|
|
420
|
+
defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}");
|
|
421
|
+
|
|
397
422
|
//////////////////////////////////////////////////////////////////////
|
|
398
423
|
// LaTeX_2ε
|
|
399
424
|
|
|
@@ -422,6 +447,9 @@ defineMacro("\\varPhi", "\\mathit{\\Phi}");
|
|
|
422
447
|
defineMacro("\\varPsi", "\\mathit{\\Psi}");
|
|
423
448
|
defineMacro("\\varOmega", "\\mathit{\\Omega}");
|
|
424
449
|
|
|
450
|
+
//\newcommand{\substack}[1]{\subarray{c}#1\endsubarray}
|
|
451
|
+
defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
|
|
452
|
+
|
|
425
453
|
// \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
|
|
426
454
|
// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
|
|
427
455
|
defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" +
|
|
@@ -655,13 +683,12 @@ defineMacro("\\mod", "\\allowbreak" +
|
|
|
655
683
|
"{\\rm mod}\\,\\,#1");
|
|
656
684
|
|
|
657
685
|
// \pmb -- A simulation of bold.
|
|
658
|
-
//
|
|
659
|
-
//
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
"\\mathrlap{\\
|
|
663
|
-
"{\\
|
|
664
|
-
"}}{\\mathbf{#1}}");
|
|
686
|
+
// The version in ambsy.sty works by typesetting three copies of the argument
|
|
687
|
+
// with small offsets. We use two copies. We omit the vertical offset because
|
|
688
|
+
// of rendering problems that makeVList encounters in Safari.
|
|
689
|
+
defineMacro("\\pmb", "\\html@mathml{" +
|
|
690
|
+
"\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" +
|
|
691
|
+
"{\\mathbf{#1}}");
|
|
665
692
|
|
|
666
693
|
//////////////////////////////////////////////////////////////////////
|
|
667
694
|
// LaTeX source2e
|
|
@@ -689,17 +716,17 @@ defineMacro("\\TeX", "\\textrm{\\html@mathml{" +
|
|
|
689
716
|
// \TeX}
|
|
690
717
|
// This code aligns the top of the A with the T (from the perspective of TeX's
|
|
691
718
|
// boxes, though visually the A appears to extend above slightly).
|
|
692
|
-
// We compute the corresponding \raisebox when A is rendered
|
|
693
|
-
//
|
|
719
|
+
// We compute the corresponding \raisebox when A is rendered in \normalsize
|
|
720
|
+
// \scriptstyle, which has a scale factor of 0.7 (see Options.js).
|
|
694
721
|
const latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] -
|
|
695
722
|
0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em";
|
|
696
723
|
defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" +
|
|
697
|
-
`L\\kern-.36em\\raisebox{${latexRaiseA}}{\\
|
|
724
|
+
`L\\kern-.36em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` +
|
|
698
725
|
"\\kern-.15em\\TeX}{LaTeX}}");
|
|
699
726
|
|
|
700
727
|
// New KaTeX logo based on tweaking LaTeX logo
|
|
701
728
|
defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" +
|
|
702
|
-
`K\\kern-.17em\\raisebox{${latexRaiseA}}{\\
|
|
729
|
+
`K\\kern-.17em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` +
|
|
703
730
|
"\\kern-.15em\\TeX}{KaTeX}}");
|
|
704
731
|
|
|
705
732
|
// \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
|
|
@@ -719,40 +746,61 @@ defineMacro("\\ordinarycolon", ":");
|
|
|
719
746
|
//TODO(edemaine): Not yet centered. Fix via \raisebox or #726
|
|
720
747
|
defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
|
|
721
748
|
// \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
|
|
722
|
-
defineMacro("\\dblcolon",
|
|
723
|
-
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}"
|
|
749
|
+
defineMacro("\\dblcolon", "\\html@mathml{" +
|
|
750
|
+
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" +
|
|
751
|
+
"{\\mathop{\\char\"2237}}");
|
|
724
752
|
// \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
|
|
725
|
-
defineMacro("\\coloneqq", "\\
|
|
753
|
+
defineMacro("\\coloneqq", "\\html@mathml{" +
|
|
754
|
+
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" +
|
|
755
|
+
"{\\mathop{\\char\"2254}}"); // ≔
|
|
726
756
|
// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
|
|
727
|
-
defineMacro("\\Coloneqq", "\\
|
|
757
|
+
defineMacro("\\Coloneqq", "\\html@mathml{" +
|
|
758
|
+
"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" +
|
|
759
|
+
"{\\mathop{\\char\"2237\\char\"3d}}");
|
|
728
760
|
// \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
|
|
729
|
-
defineMacro("\\coloneq",
|
|
730
|
-
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"
|
|
761
|
+
defineMacro("\\coloneq", "\\html@mathml{" +
|
|
762
|
+
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" +
|
|
763
|
+
"{\\mathop{\\char\"3a\\char\"2212}}");
|
|
731
764
|
// \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
|
|
732
|
-
defineMacro("\\Coloneq",
|
|
733
|
-
"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"
|
|
765
|
+
defineMacro("\\Coloneq", "\\html@mathml{" +
|
|
766
|
+
"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" +
|
|
767
|
+
"{\\mathop{\\char\"2237\\char\"2212}}");
|
|
734
768
|
// \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
|
|
735
|
-
defineMacro("\\eqqcolon", "\\
|
|
769
|
+
defineMacro("\\eqqcolon", "\\html@mathml{" +
|
|
770
|
+
"\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" +
|
|
771
|
+
"{\\mathop{\\char\"2255}}"); // ≕
|
|
736
772
|
// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
|
|
737
|
-
defineMacro("\\Eqqcolon", "\\
|
|
773
|
+
defineMacro("\\Eqqcolon", "\\html@mathml{" +
|
|
774
|
+
"\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" +
|
|
775
|
+
"{\\mathop{\\char\"3d\\char\"2237}}");
|
|
738
776
|
// \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
|
|
739
|
-
defineMacro("\\eqcolon",
|
|
740
|
-
"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}"
|
|
777
|
+
defineMacro("\\eqcolon", "\\html@mathml{" +
|
|
778
|
+
"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" +
|
|
779
|
+
"{\\mathop{\\char\"2239}}");
|
|
741
780
|
// \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
|
|
742
|
-
defineMacro("\\Eqcolon",
|
|
743
|
-
"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"
|
|
781
|
+
defineMacro("\\Eqcolon", "\\html@mathml{" +
|
|
782
|
+
"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" +
|
|
783
|
+
"{\\mathop{\\char\"2212\\char\"2237}}");
|
|
744
784
|
// \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
|
|
745
|
-
defineMacro("\\colonapprox",
|
|
746
|
-
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}"
|
|
785
|
+
defineMacro("\\colonapprox", "\\html@mathml{" +
|
|
786
|
+
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" +
|
|
787
|
+
"{\\mathop{\\char\"3a\\char\"2248}}");
|
|
747
788
|
// \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
|
|
748
|
-
defineMacro("\\Colonapprox",
|
|
749
|
-
"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}"
|
|
789
|
+
defineMacro("\\Colonapprox", "\\html@mathml{" +
|
|
790
|
+
"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" +
|
|
791
|
+
"{\\mathop{\\char\"2237\\char\"2248}}");
|
|
750
792
|
// \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
|
|
751
|
-
defineMacro("\\colonsim", "\\
|
|
793
|
+
defineMacro("\\colonsim", "\\html@mathml{" +
|
|
794
|
+
"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" +
|
|
795
|
+
"{\\mathop{\\char\"3a\\char\"223c}}");
|
|
752
796
|
// \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
|
|
753
|
-
defineMacro("\\Colonsim", "\\
|
|
797
|
+
defineMacro("\\Colonsim", "\\html@mathml{" +
|
|
798
|
+
"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" +
|
|
799
|
+
"{\\mathop{\\char\"2237\\char\"223c}}");
|
|
754
800
|
|
|
755
801
|
// Some Unicode characters are implemented with macros to mathtools functions.
|
|
802
|
+
defineMacro("\u2237", "\\dblcolon"); // ::
|
|
803
|
+
defineMacro("\u2239", "\\eqcolon"); // -:
|
|
756
804
|
defineMacro("\u2254", "\\coloneqq"); // :=
|
|
757
805
|
defineMacro("\u2255", "\\eqqcolon"); // =:
|
|
758
806
|
defineMacro("\u2A74", "\\Coloneqq"); // ::=
|
|
@@ -788,21 +836,65 @@ defineMacro("\\approxcoloncolon",
|
|
|
788
836
|
|
|
789
837
|
// Present in newtxmath, pxfonts and txfonts
|
|
790
838
|
defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
|
|
791
|
-
defineMacro("\\limsup", "\\DOTSB\\
|
|
792
|
-
defineMacro("\\liminf", "\\DOTSB\\
|
|
839
|
+
defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
|
|
840
|
+
defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
|
|
841
|
+
|
|
842
|
+
//////////////////////////////////////////////////////////////////////
|
|
843
|
+
// MathML alternates for KaTeX glyphs in the Unicode private area
|
|
844
|
+
defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
|
|
845
|
+
defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
|
|
846
|
+
defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
|
|
847
|
+
defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
|
|
848
|
+
defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
|
|
849
|
+
defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
|
|
850
|
+
defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
|
|
851
|
+
defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
|
|
852
|
+
defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
|
|
853
|
+
defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
|
|
854
|
+
defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
|
|
855
|
+
defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
|
|
856
|
+
defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
|
|
857
|
+
defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
|
|
858
|
+
defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}");
|
|
859
|
+
defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}");
|
|
793
860
|
|
|
794
861
|
//////////////////////////////////////////////////////////////////////
|
|
795
|
-
// semantic
|
|
862
|
+
// stmaryrd and semantic
|
|
863
|
+
|
|
864
|
+
// The stmaryrd and semantic packages render the next four items by calling a
|
|
865
|
+
// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
|
|
866
|
+
|
|
867
|
+
defineMacro("\\llbracket", "\\html@mathml{" +
|
|
868
|
+
"\\mathopen{[\\mkern-3.2mu[}}" +
|
|
869
|
+
"{\\mathopen{\\char`\u27e6}}");
|
|
870
|
+
defineMacro("\\rrbracket", "\\html@mathml{" +
|
|
871
|
+
"\\mathclose{]\\mkern-3.2mu]}}" +
|
|
872
|
+
"{\\mathclose{\\char`\u27e7}}");
|
|
873
|
+
|
|
874
|
+
defineMacro("\u27e6", "\\llbracket"); // blackboard bold [
|
|
875
|
+
defineMacro("\u27e7", "\\rrbracket"); // blackboard bold ]
|
|
796
876
|
|
|
797
|
-
|
|
798
|
-
|
|
877
|
+
defineMacro("\\lBrace", "\\html@mathml{" +
|
|
878
|
+
"\\mathopen{\\{\\mkern-3.2mu[}}" +
|
|
879
|
+
"{\\mathopen{\\char`\u2983}}");
|
|
880
|
+
defineMacro("\\rBrace", "\\html@mathml{" +
|
|
881
|
+
"\\mathclose{]\\mkern-3.2mu\\}}}" +
|
|
882
|
+
"{\\mathclose{\\char`\u2984}}");
|
|
799
883
|
|
|
800
|
-
defineMacro("\
|
|
801
|
-
defineMacro("\
|
|
884
|
+
defineMacro("\u2983", "\\lBrace"); // blackboard bold {
|
|
885
|
+
defineMacro("\u2984", "\\rBrace"); // blackboard bold }
|
|
802
886
|
|
|
803
887
|
// TODO: Create variable sized versions of the last two items. I believe that
|
|
804
888
|
// will require new font glyphs.
|
|
805
889
|
|
|
890
|
+
// The stmaryrd function `\minuso` provides a "Plimsoll" symbol that
|
|
891
|
+
// superimposes the characters \circ and \mathminus. Used in chemistry.
|
|
892
|
+
defineMacro("\\minuso", "\\mathbin{\\html@mathml{" +
|
|
893
|
+
"{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" +
|
|
894
|
+
"{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" +
|
|
895
|
+
"{\\char`⦵}}");
|
|
896
|
+
defineMacro("⦵", "\\minuso");
|
|
897
|
+
|
|
806
898
|
//////////////////////////////////////////////////////////////////////
|
|
807
899
|
// texvc.sty
|
|
808
900
|
|
|
@@ -864,7 +956,7 @@ defineMacro("\\Rarr", "\\Rightarrow");
|
|
|
864
956
|
defineMacro("\\real", "\\Re");
|
|
865
957
|
defineMacro("\\reals", "\\mathbb{R}");
|
|
866
958
|
defineMacro("\\Reals", "\\mathbb{R}");
|
|
867
|
-
defineMacro("\\Rho", "\\mathrm{
|
|
959
|
+
defineMacro("\\Rho", "\\mathrm{P}");
|
|
868
960
|
defineMacro("\\sdot", "\\cdot");
|
|
869
961
|
defineMacro("\\sect", "\\S");
|
|
870
962
|
defineMacro("\\spades", "\\spadesuit");
|
|
@@ -881,5 +973,74 @@ defineMacro("\\Zeta", "\\mathrm{Z}");
|
|
|
881
973
|
// statmath.sty
|
|
882
974
|
// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
|
|
883
975
|
|
|
884
|
-
defineMacro("\\argmin", "\\DOTSB\\
|
|
885
|
-
defineMacro("\\argmax", "\\DOTSB\\
|
|
976
|
+
defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
|
|
977
|
+
defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
|
|
978
|
+
defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
|
|
979
|
+
|
|
980
|
+
//////////////////////////////////////////////////////////////////////
|
|
981
|
+
// braket.sty
|
|
982
|
+
// http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf
|
|
983
|
+
|
|
984
|
+
defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
|
|
985
|
+
defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
|
|
986
|
+
defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
|
|
987
|
+
defineMacro("\\Bra", "\\left\\langle#1\\right|");
|
|
988
|
+
defineMacro("\\Ket", "\\left|#1\\right\\rangle");
|
|
989
|
+
|
|
990
|
+
// Custom Khan Academy colors, should be moved to an optional package
|
|
991
|
+
defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
|
|
992
|
+
defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
|
|
993
|
+
defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
|
|
994
|
+
defineMacro("\\red", "\\textcolor{##df0030}{#1}");
|
|
995
|
+
defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
|
|
996
|
+
defineMacro("\\gray", "\\textcolor{gray}{#1}");
|
|
997
|
+
defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
|
|
998
|
+
defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
|
|
999
|
+
defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
|
|
1000
|
+
defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
|
|
1001
|
+
defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
|
|
1002
|
+
defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
|
|
1003
|
+
defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
|
|
1004
|
+
defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
|
|
1005
|
+
defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
|
|
1006
|
+
defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
|
|
1007
|
+
defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
|
|
1008
|
+
defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
|
|
1009
|
+
defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
|
|
1010
|
+
defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
|
|
1011
|
+
defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
|
|
1012
|
+
defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
|
|
1013
|
+
defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
|
|
1014
|
+
defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
|
|
1015
|
+
defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
|
|
1016
|
+
defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
|
|
1017
|
+
defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
|
|
1018
|
+
defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
|
|
1019
|
+
defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
|
|
1020
|
+
defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
|
|
1021
|
+
defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
|
|
1022
|
+
defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
|
|
1023
|
+
defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
|
|
1024
|
+
defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
|
|
1025
|
+
defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
|
|
1026
|
+
defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
|
|
1027
|
+
defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
|
|
1028
|
+
defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
|
|
1029
|
+
defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
|
|
1030
|
+
defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
|
|
1031
|
+
defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
|
|
1032
|
+
defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
|
|
1033
|
+
defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
|
|
1034
|
+
defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
|
|
1035
|
+
defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
|
|
1036
|
+
defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
|
|
1037
|
+
defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
|
|
1038
|
+
defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
|
|
1039
|
+
defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
|
|
1040
|
+
defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
|
|
1041
|
+
defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
|
|
1042
|
+
defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
|
|
1043
|
+
defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
|
|
1044
|
+
defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
|
|
1045
|
+
defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
|
|
1046
|
+
defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
|
package/src/mathMLTree.js
CHANGED
|
@@ -25,14 +25,16 @@ export type MathNodeType =
|
|
|
25
25
|
"mfrac" | "mroot" | "msqrt" |
|
|
26
26
|
"mtable" | "mtr" | "mtd" | "mlabeledtr" |
|
|
27
27
|
"mrow" | "menclose" |
|
|
28
|
-
"mstyle" | "mpadded" | "mphantom";
|
|
28
|
+
"mstyle" | "mpadded" | "mphantom" | "mglyph";
|
|
29
29
|
|
|
30
30
|
export interface MathDomNode extends VirtualNode {
|
|
31
31
|
toText(): string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export type documentFragment = DocumentFragment<MathDomNode>;
|
|
35
|
-
export function newDocumentFragment(
|
|
35
|
+
export function newDocumentFragment(
|
|
36
|
+
children: $ReadOnlyArray<MathDomNode>
|
|
37
|
+
): documentFragment {
|
|
36
38
|
return new DocumentFragment(children);
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -44,9 +46,9 @@ export function newDocumentFragment(children: MathDomNode[]): documentFragment {
|
|
|
44
46
|
export class MathNode implements MathDomNode {
|
|
45
47
|
type: MathNodeType;
|
|
46
48
|
attributes: {[string]: string};
|
|
47
|
-
children: MathDomNode
|
|
49
|
+
children: $ReadOnlyArray<MathDomNode>;
|
|
48
50
|
|
|
49
|
-
constructor(type: MathNodeType, children?: MathDomNode
|
|
51
|
+
constructor(type: MathNodeType, children?: $ReadOnlyArray<MathDomNode>) {
|
|
50
52
|
this.type = type;
|
|
51
53
|
this.attributes = {};
|
|
52
54
|
this.children = children || [];
|