@pie-lib/math-rendering 3.18.1-next.0 → 3.19.2
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/esm/index.js +690 -0
- package/esm/index.js.map +1 -0
- package/package.json +10 -3
- package/LICENSE.md +0 -5
package/esm/index.js
ADDED
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { mathjax } from 'mathjax-full/js/mathjax';
|
|
2
|
+
import { MathJax } from 'mathjax-full/js/components/global';
|
|
3
|
+
import { AssistiveMmlHandler } from 'mathjax-full/js/a11y/assistive-mml';
|
|
4
|
+
import { EnrichHandler } from 'mathjax-full/js/a11y/semantic-enrich';
|
|
5
|
+
import { MenuHandler } from 'mathjax-full/js/ui/menu/MenuHandler';
|
|
6
|
+
import { FindMathML } from 'mathjax-full/js/input/mathml/FindMathML';
|
|
7
|
+
import { MathML } from 'mathjax-full/js/input/mathml';
|
|
8
|
+
import { TeX } from 'mathjax-full/js/input/tex';
|
|
9
|
+
import { CHTML } from 'mathjax-full/js/output/chtml';
|
|
10
|
+
import { RegisterHTMLHandler } from 'mathjax-full/js/handlers/html';
|
|
11
|
+
import { browserAdaptor } from 'mathjax-full/js/adaptors/browserAdaptor';
|
|
12
|
+
import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';
|
|
13
|
+
import { engineReady } from 'speech-rule-engine/js/common/system';
|
|
14
|
+
import { CHTMLWrapper } from 'mathjax-full/js/output/chtml/Wrapper';
|
|
15
|
+
import _ from 'lodash';
|
|
16
|
+
import { AbstractMmlNode } from 'mathjax-full/js/core/MmlTree/MmlNode';
|
|
17
|
+
import debug from 'debug';
|
|
18
|
+
import { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';
|
|
19
|
+
import { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';
|
|
20
|
+
import { CHTMLWrapperFactory } from 'mathjax-full/js/output/chtml/WrapperFactory';
|
|
21
|
+
import { CHTMLmspace } from 'mathjax-full/js/output/chtml/Wrappers/mspace';
|
|
22
|
+
import { HTMLDomStrings } from 'mathjax-full/js/handlers/html/HTMLDomStrings';
|
|
23
|
+
import { MathMLToLaTeX } from '@pie-framework/mathml-to-latex';
|
|
24
|
+
|
|
25
|
+
function _extends() {
|
|
26
|
+
_extends = Object.assign || function (target) {
|
|
27
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
28
|
+
var source = arguments[i];
|
|
29
|
+
|
|
30
|
+
for (var key in source) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return target;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return _extends.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const reduceText = (acc, n) => {
|
|
44
|
+
if (n.node && n.node.kind === 'text') {
|
|
45
|
+
acc += n.node.text;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return acc;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
class Line {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.kind = 'line';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get columns() {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
class Row {
|
|
62
|
+
constructor(columns, operator) {
|
|
63
|
+
this.kind = 'row';
|
|
64
|
+
this.operator = operator;
|
|
65
|
+
this.columns = columns;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pad(count, direction = 'right') {
|
|
69
|
+
if (count < this.columns.length) {
|
|
70
|
+
throw new Error('no');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const diff = count - this.columns.length;
|
|
74
|
+
|
|
75
|
+
const padding = _.times(diff).map(() => '__pad__');
|
|
76
|
+
|
|
77
|
+
return direction === 'right' ? [...padding, ...this.columns] : [...this.columns, ...padding];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const mathNodeToCharArray = mn => {
|
|
83
|
+
const text = mn.childNodes.reduce(reduceText, '');
|
|
84
|
+
return text.split('');
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Convert child a column entry
|
|
88
|
+
* @param {*} child
|
|
89
|
+
* @return an array of column content
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
const toColumnArray = child => {
|
|
94
|
+
if (!child || !child.kind) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (child.kind === 'msrow') {
|
|
99
|
+
throw new Error('msrow in msrow?');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (child.kind === 'mo') {
|
|
103
|
+
// We are going to treat this operator as a text array.
|
|
104
|
+
// It's probably going to be a decimal point
|
|
105
|
+
// eslint-disable-next-line no-console
|
|
106
|
+
console.warn('mo that is not 1st node in msrow?');
|
|
107
|
+
return mathNodeToCharArray(child); // throw new Error('mo must be first child of msrow');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (child.kind === 'mn') {
|
|
111
|
+
return mathNodeToCharArray(child);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (child.toCHTML) {
|
|
115
|
+
return child;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* convert mstack chtml childNodes into a Row
|
|
120
|
+
* @param child chtml child node of mstack
|
|
121
|
+
* @return Row | Line
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
const rowStack = child => {
|
|
126
|
+
if (!child || !child.kind) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (child.kind === 'msrow') {
|
|
131
|
+
if (!child.childNodes || child.childNodes.length === 0) {
|
|
132
|
+
return new Row([]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const f = _.first(child.childNodes);
|
|
136
|
+
|
|
137
|
+
const nodes = f && f.kind === 'mo' ? _.tail(child.childNodes) : child.childNodes;
|
|
138
|
+
|
|
139
|
+
const columns = _.flatten(nodes.map(toColumnArray));
|
|
140
|
+
|
|
141
|
+
return new Row(columns, f.kind === 'mo' ? f : undefined);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (child.kind === 'mn') {
|
|
145
|
+
const columns = mathNodeToCharArray(child);
|
|
146
|
+
return new Row(columns, undefined);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (child.kind === 'mo') {
|
|
150
|
+
// eslint-disable-next-line no-console
|
|
151
|
+
console.warn('mo on its own row?');
|
|
152
|
+
return new Row([], child);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (child.kind === 'msline') {
|
|
156
|
+
return new Line();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (child.toCHTML) {
|
|
160
|
+
return new Row([child]);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
/** convert MathJax chtml tree to Row[]
|
|
164
|
+
* @param mstack the root of the mathjax chtml tree
|
|
165
|
+
* @return Row[]
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
const getStackData = mstack => {
|
|
170
|
+
if (!mstack || !mstack.childNodes) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return _.compact(mstack.childNodes.map(rowStack));
|
|
175
|
+
};
|
|
176
|
+
class CHTMLmstack extends CHTMLWrapper {
|
|
177
|
+
constructor(factory, node, parent = null) {
|
|
178
|
+
super(factory, node, parent);
|
|
179
|
+
this.ce = this.adaptor.document.createElement.bind(this.adaptor.document);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
toCHTML(parent) {
|
|
183
|
+
const chtml = this.standardCHTMLnode(parent);
|
|
184
|
+
const stackData = getStackData(this); // console.log('stackData', stackData);
|
|
185
|
+
|
|
186
|
+
const maxCols = stackData.reduce((acc, r) => {
|
|
187
|
+
if (r && r.columns.length > acc) {
|
|
188
|
+
acc = r.columns.length;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return acc;
|
|
192
|
+
}, 0);
|
|
193
|
+
const table = this.ce('table');
|
|
194
|
+
chtml.appendChild(table);
|
|
195
|
+
stackData.forEach(row => {
|
|
196
|
+
const tr = this.ce('tr');
|
|
197
|
+
table.appendChild(tr);
|
|
198
|
+
|
|
199
|
+
if (row.kind === 'row') {
|
|
200
|
+
const td = this.ce('td');
|
|
201
|
+
tr.appendChild(td);
|
|
202
|
+
|
|
203
|
+
if (row.operator && row.operator.toCHTML) {
|
|
204
|
+
td.setAttribute('class', 'inner');
|
|
205
|
+
row.operator.toCHTML(td);
|
|
206
|
+
} else {
|
|
207
|
+
td.textContent = '';
|
|
208
|
+
} // align right for now:
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
const cols = row.pad(maxCols, 'right');
|
|
212
|
+
cols.forEach(c => {
|
|
213
|
+
const t = this.ce('td');
|
|
214
|
+
tr.appendChild(t);
|
|
215
|
+
|
|
216
|
+
if (c === '__pad__') {
|
|
217
|
+
t.textContent = '';
|
|
218
|
+
} else if (typeof c === 'string') {
|
|
219
|
+
t.textContent = c;
|
|
220
|
+
} else if (c.kind === 'none') {
|
|
221
|
+
t.textContent = '';
|
|
222
|
+
} else if (c.toCHTML) {
|
|
223
|
+
t.setAttribute('class', 'inner');
|
|
224
|
+
c.toCHTML(t);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
} else if (row.kind === 'line') {
|
|
228
|
+
const td = this.ce('td');
|
|
229
|
+
tr.appendChild(td);
|
|
230
|
+
td.setAttribute('colspan', maxCols + 1);
|
|
231
|
+
td.setAttribute('class', 'mjx-line');
|
|
232
|
+
td.textContent = '';
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
CHTMLmstack.styles = {
|
|
239
|
+
'mjx-mstack > table': {
|
|
240
|
+
'line-height': 'initial',
|
|
241
|
+
border: 'solid 0px red',
|
|
242
|
+
'border-spacing': '0em',
|
|
243
|
+
'border-collapse': 'separate'
|
|
244
|
+
},
|
|
245
|
+
'mjx-mstack > table > tr': {
|
|
246
|
+
'line-height': 'initial'
|
|
247
|
+
},
|
|
248
|
+
'mjx-mstack > table > tr > td': {
|
|
249
|
+
// padding: '1.2rem',
|
|
250
|
+
border: 'solid 0px blue',
|
|
251
|
+
'font-family': 'sans-serif',
|
|
252
|
+
'line-height': 'initial'
|
|
253
|
+
},
|
|
254
|
+
'mjx-mstack > table > tr > td.inner': {
|
|
255
|
+
'font-family': 'inherit'
|
|
256
|
+
},
|
|
257
|
+
'mjx-mstack > table > tr > .mjx-line': {
|
|
258
|
+
padding: 0,
|
|
259
|
+
'border-top': 'solid 1px black'
|
|
260
|
+
},
|
|
261
|
+
'.TEX-A': {
|
|
262
|
+
'font-family': 'MJXZERO, MJXTEX !important'
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
class MmlNone extends AbstractMmlNode {
|
|
267
|
+
get kind() {
|
|
268
|
+
return 'none';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
class MmlMstack extends AbstractMmlNode {
|
|
273
|
+
get kind() {
|
|
274
|
+
return 'mstack';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
class MmlMsrow extends AbstractMmlNode {
|
|
279
|
+
get kind() {
|
|
280
|
+
return 'msrow';
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
}
|
|
284
|
+
class MmlMsline extends AbstractMmlNode {
|
|
285
|
+
get kind() {
|
|
286
|
+
return 'msline';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const chtmlNodes = {
|
|
292
|
+
mstack: CHTMLmstack
|
|
293
|
+
};
|
|
294
|
+
const mmlNodes = {
|
|
295
|
+
mstack: MmlMstack,
|
|
296
|
+
msline: MmlMsline,
|
|
297
|
+
msrow: MmlMsrow,
|
|
298
|
+
none: MmlNone
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const BracketTypes = {};
|
|
302
|
+
BracketTypes.ROUND_BRACKETS = 'round_brackets';
|
|
303
|
+
BracketTypes.SQUARE_BRACKETS = 'square_brackets';
|
|
304
|
+
BracketTypes.DOLLAR = 'dollar';
|
|
305
|
+
BracketTypes.DOUBLE_DOLLAR = 'double_dollar';
|
|
306
|
+
const PAIRS = {
|
|
307
|
+
[BracketTypes.ROUND_BRACKETS]: ['\\(', '\\)'],
|
|
308
|
+
[BracketTypes.SQUARE_BRACKETS]: ['\\[', '\\]'],
|
|
309
|
+
[BracketTypes.DOLLAR]: ['$', '$'],
|
|
310
|
+
[BracketTypes.DOUBLE_DOLLAR]: ['$$', '$$']
|
|
311
|
+
};
|
|
312
|
+
const wrapMath = (content, wrapType) => {
|
|
313
|
+
if (wrapType === BracketTypes.SQUARE_BRACKETS) {
|
|
314
|
+
console.warn('\\[...\\] is not supported yet'); // eslint-disable-line
|
|
315
|
+
|
|
316
|
+
wrapType = BracketTypes.ROUND_BRACKETS;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (wrapType === BracketTypes.DOUBLE_DOLLAR) {
|
|
320
|
+
console.warn('$$...$$ is not supported yet'); // eslint-disable-line
|
|
321
|
+
|
|
322
|
+
wrapType = BracketTypes.DOLLAR;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];
|
|
326
|
+
return `${start}${content}${end}`;
|
|
327
|
+
};
|
|
328
|
+
const unWrapMath = content => {
|
|
329
|
+
const displayStyleIndex = content.indexOf('\\displaystyle');
|
|
330
|
+
|
|
331
|
+
if (displayStyleIndex !== -1) {
|
|
332
|
+
console.warn('\\displaystyle is not supported - removing'); // eslint-disable-line
|
|
333
|
+
|
|
334
|
+
content = content.replace('\\displaystyle', '').trim();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (content.startsWith('$$') && content.endsWith('$$')) {
|
|
338
|
+
console.warn('$$ syntax is not yet supported'); // eslint-disable-line
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
unwrapped: content.substring(2, content.length - 2),
|
|
342
|
+
wrapType: BracketTypes.DOLLAR
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (content.startsWith('$') && content.endsWith('$')) {
|
|
347
|
+
return {
|
|
348
|
+
unwrapped: content.substring(1, content.length - 1),
|
|
349
|
+
wrapType: BracketTypes.DOLLAR
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (content.startsWith('\\[') && content.endsWith('\\]')) {
|
|
354
|
+
console.warn('\\[..\\] syntax is not yet supported'); // eslint-disable-line
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
unwrapped: content.substring(2, content.length - 2),
|
|
358
|
+
wrapType: BracketTypes.ROUND_BRACKETS
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (content.startsWith('\\(') && content.endsWith('\\)')) {
|
|
363
|
+
return {
|
|
364
|
+
unwrapped: content.substring(2, content.length - 2),
|
|
365
|
+
wrapType: BracketTypes.ROUND_BRACKETS
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return {
|
|
370
|
+
unwrapped: content,
|
|
371
|
+
wrapType: BracketTypes.ROUND_BRACKETS
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
if (typeof window !== 'undefined') {
|
|
376
|
+
RegisterHTMLHandler(browserAdaptor());
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
let sreReady = false;
|
|
380
|
+
engineReady().then(() => {
|
|
381
|
+
sreReady = true;
|
|
382
|
+
}); // import pkg from '../../package.json';
|
|
383
|
+
const visitor = new SerializedMmlVisitor();
|
|
384
|
+
|
|
385
|
+
const toMMl = node => visitor.visitTree(node);
|
|
386
|
+
|
|
387
|
+
const log = debug('pie-lib:math-rendering');
|
|
388
|
+
const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
389
|
+
const NEWLINE_LATEX = '\\newline ';
|
|
390
|
+
|
|
391
|
+
const getGlobal = () => {
|
|
392
|
+
// TODO does it make sense to use version?
|
|
393
|
+
// const key = `${pkg.name}@${pkg.version.split('.')[0]}`;
|
|
394
|
+
// It looks like Ed made this change when he switched from mathjax3 to mathjax-full
|
|
395
|
+
// I think it was supposed to make sure version 1 (using mathjax3) is not used
|
|
396
|
+
// in combination with version 2 (using mathjax-full)
|
|
397
|
+
// TODO higher level wrappers use this instance of math-rendering, and if 2 different instances are used, math rendering is not working
|
|
398
|
+
// so I will hardcode this for now until a better solution is found
|
|
399
|
+
const key = '@pie-lib/math-rendering@2';
|
|
400
|
+
|
|
401
|
+
if (typeof window !== 'undefined') {
|
|
402
|
+
if (!window[key]) {
|
|
403
|
+
window[key] = {};
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return window[key];
|
|
407
|
+
} else {
|
|
408
|
+
return {};
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
/** Add temporary support for a global singleDollar override
|
|
412
|
+
* <code>
|
|
413
|
+
* // This will enable single dollar rendering
|
|
414
|
+
* window.pie = window.pie || {};
|
|
415
|
+
* window.pie.mathRendering = {useSingleDollar: true };
|
|
416
|
+
* </code>
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
const defaultOpts = () => getGlobal().opts || {};
|
|
421
|
+
|
|
422
|
+
const fixMathElement = element => {
|
|
423
|
+
if (element.dataset.mathHandled) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
let property = 'innerText';
|
|
428
|
+
|
|
429
|
+
if (element.textContent) {
|
|
430
|
+
property = 'textContent';
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (element[property]) {
|
|
434
|
+
element[property] = wrapMath(unWrapMath(element[property]).unwrapped); // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.
|
|
435
|
+
// we need to replace the custom embedded elements with valid latex that Mathjax can understand
|
|
436
|
+
|
|
437
|
+
element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);
|
|
438
|
+
element.dataset.mathHandled = true;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
const fixMathElements = (el = document) => {
|
|
442
|
+
const mathElements = el.querySelectorAll('[data-latex]');
|
|
443
|
+
mathElements.forEach(item => fixMathElement(item));
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const adjustMathMLStyle = (el = document) => {
|
|
447
|
+
const nodes = el.querySelectorAll('math');
|
|
448
|
+
nodes.forEach(node => node.setAttribute('displaystyle', 'true'));
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
class myFindMathML extends FindMathML {
|
|
452
|
+
processMath(set) {
|
|
453
|
+
const adaptor = this.adaptor;
|
|
454
|
+
|
|
455
|
+
for (const mml of Array.from(set)) {
|
|
456
|
+
if (adaptor.kind(adaptor.parent(mml)) === 'mjx-assistive-mml') {
|
|
457
|
+
set.delete(mml);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return super.processMath(set);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const createMathMLInstance = (opts, docProvided = document) => {
|
|
467
|
+
opts = opts || defaultOpts();
|
|
468
|
+
|
|
469
|
+
if (opts.useSingleDollar) {
|
|
470
|
+
// eslint-disable-next-line
|
|
471
|
+
console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const packages = AllPackages.filter(name => name !== 'bussproofs'); // Bussproofs needs an output jax
|
|
475
|
+
// The autoload extension predefines all the macros from the extensions that haven't been loaded already
|
|
476
|
+
// so that they automatically load the needed extension when they are first used
|
|
477
|
+
|
|
478
|
+
packages.push('autoload');
|
|
479
|
+
const macros = {
|
|
480
|
+
parallelogram: '\\lower.2em{\\Huge\\unicode{x25B1}}',
|
|
481
|
+
overarc: '\\overparen',
|
|
482
|
+
napprox: '\\not\\approx',
|
|
483
|
+
longdiv: '\\enclose{longdiv}'
|
|
484
|
+
};
|
|
485
|
+
const texConfig = opts.useSingleDollar ? {
|
|
486
|
+
packages,
|
|
487
|
+
macros,
|
|
488
|
+
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
489
|
+
processEscapes: true
|
|
490
|
+
} : {
|
|
491
|
+
packages,
|
|
492
|
+
macros
|
|
493
|
+
};
|
|
494
|
+
const mmlConfig = {
|
|
495
|
+
parseError: function (node) {
|
|
496
|
+
// function to process parsing errors
|
|
497
|
+
// eslint-disable-next-line no-console
|
|
498
|
+
console.log('error:', node);
|
|
499
|
+
this.error(this.adaptor.textContent(node).replace(/\n.*/g, ''));
|
|
500
|
+
},
|
|
501
|
+
FindMathML: new myFindMathML()
|
|
502
|
+
};
|
|
503
|
+
let cachedMathjax;
|
|
504
|
+
|
|
505
|
+
if (MathJax && MathJax.version !== mathjax.version) {
|
|
506
|
+
// handling other MathJax version on the page
|
|
507
|
+
// replacing it temporarily with the version we have
|
|
508
|
+
window.MathJax._ = window.MathJax._ || {};
|
|
509
|
+
window.MathJax.config = window.MathJax.config || {};
|
|
510
|
+
cachedMathjax = window.MathJax;
|
|
511
|
+
Object.assign(MathJax, mathjax);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
const fontURL = `https://unpkg.com/mathjax-full@${mathjax.version}/ts/output/chtml/fonts/tex-woff-v2`;
|
|
515
|
+
const htmlConfig = {
|
|
516
|
+
fontURL,
|
|
517
|
+
wrapperFactory: new CHTMLWrapperFactory(_extends({}, CHTMLWrapperFactory.defaultNodes, chtmlNodes))
|
|
518
|
+
};
|
|
519
|
+
const mml = new MathML(mmlConfig);
|
|
520
|
+
const customMmlFactory = new MmlFactory(_extends({}, MmlFactory.defaultNodes, mmlNodes));
|
|
521
|
+
const classFactory = EnrichHandler(MenuHandler(AssistiveMmlHandler(mathjax.handlers.handlesDocument(docProvided))), mml);
|
|
522
|
+
const html = classFactory.create(docProvided, {
|
|
523
|
+
compileError: (mj, math, err) => {
|
|
524
|
+
// eslint-disable-next-line no-console
|
|
525
|
+
console.log('bad math?:', math); // eslint-disable-next-line no-console
|
|
526
|
+
|
|
527
|
+
console.error(err);
|
|
528
|
+
},
|
|
529
|
+
typesetError: function (doc, math, err) {
|
|
530
|
+
// eslint-disable-next-line no-console
|
|
531
|
+
console.log('typeset error'); // eslint-disable-next-line no-console
|
|
532
|
+
|
|
533
|
+
console.error(err);
|
|
534
|
+
doc.typesetError(math, err);
|
|
535
|
+
},
|
|
536
|
+
sre: {
|
|
537
|
+
speech: 'deep'
|
|
538
|
+
},
|
|
539
|
+
enrichSpeech: 'deep',
|
|
540
|
+
InputJax: [new TeX(texConfig), mml],
|
|
541
|
+
OutputJax: new CHTML(htmlConfig),
|
|
542
|
+
DomStrings: new HTMLDomStrings({
|
|
543
|
+
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code', 'annotation', 'annotation-xml', 'mjx-assistive-mml', 'mjx-container']
|
|
544
|
+
})
|
|
545
|
+
}); // Note: we must set this *after* mathjax.document (no idea why)
|
|
546
|
+
|
|
547
|
+
mml.setMmlFactory(customMmlFactory);
|
|
548
|
+
|
|
549
|
+
if (cachedMathjax) {
|
|
550
|
+
// if we have a cached version, we replace it here
|
|
551
|
+
window.MathJax = cachedMathjax;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return html;
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
let enrichSpeechInitialized = false;
|
|
558
|
+
|
|
559
|
+
const bootstrap = opts => {
|
|
560
|
+
if (typeof window === 'undefined') {
|
|
561
|
+
return {
|
|
562
|
+
Typeset: () => ({})
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const html = createMathMLInstance(opts);
|
|
567
|
+
return {
|
|
568
|
+
version: mathjax.version,
|
|
569
|
+
html: html,
|
|
570
|
+
Typeset: function (...elements) {
|
|
571
|
+
const attemptRender = (temporary = false) => {
|
|
572
|
+
var _updatedDocument$math, _updatedDocument$math2;
|
|
573
|
+
|
|
574
|
+
let updatedDocument = this.html.findMath(elements.length ? {
|
|
575
|
+
elements
|
|
576
|
+
} : {}).compile();
|
|
577
|
+
|
|
578
|
+
if (!temporary && sreReady) {
|
|
579
|
+
updatedDocument = updatedDocument.enrich();
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
updatedDocument = updatedDocument.getMetrics().typeset().assistiveMml().attachSpeech().addMenu().updateDocument();
|
|
583
|
+
|
|
584
|
+
if (!enrichSpeechInitialized && typeof ((_updatedDocument$math = updatedDocument.math.list) == null ? void 0 : (_updatedDocument$math2 = _updatedDocument$math.next) == null ? void 0 : _updatedDocument$math2.data) === 'object') {
|
|
585
|
+
enrichSpeechInitialized = true;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
try {
|
|
589
|
+
const list = updatedDocument.math.list;
|
|
590
|
+
|
|
591
|
+
if (list) {
|
|
592
|
+
for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {
|
|
593
|
+
const mathMl = toMMl(item.data.root);
|
|
594
|
+
const parsedMathMl = mathMl.replaceAll('\n', '');
|
|
595
|
+
item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
|
|
596
|
+
item.data.typesetRoot.setAttribute('tabindex', '-1');
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
} catch (e) {
|
|
600
|
+
// eslint-disable-next-line no-console
|
|
601
|
+
console.error(e.toString());
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
updatedDocument.clear();
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
if (!enrichSpeechInitialized) {
|
|
608
|
+
attemptRender(true);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
mathjax.handleRetriesFor(() => {
|
|
612
|
+
attemptRender();
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
const renderMath = (el, renderOpts) => {
|
|
619
|
+
var _getGlobal$instance, _getGlobal$instance2;
|
|
620
|
+
|
|
621
|
+
if (window && window.MathJax && window.MathJax.customKey && window.MathJax.customKey == '@pie-lib/math-rendering-accessible@1') {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
const isString = typeof el === 'string';
|
|
626
|
+
let executeOn = document.body;
|
|
627
|
+
|
|
628
|
+
if (isString) {
|
|
629
|
+
const div = document.createElement('div');
|
|
630
|
+
div.innerHTML = el;
|
|
631
|
+
executeOn = div;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
fixMathElements(executeOn);
|
|
635
|
+
adjustMathMLStyle(executeOn);
|
|
636
|
+
|
|
637
|
+
if (isString) {
|
|
638
|
+
const html = createMathMLInstance(undefined, executeOn);
|
|
639
|
+
const updatedDocument = html.findMath().compile().getMetrics().typeset().updateDocument();
|
|
640
|
+
const list = updatedDocument.math.list;
|
|
641
|
+
const item = list.next;
|
|
642
|
+
|
|
643
|
+
if (!item) {
|
|
644
|
+
return '';
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const mathMl = toMMl(item.data.root);
|
|
648
|
+
const parsedMathMl = mathMl.replaceAll('\n', '');
|
|
649
|
+
return parsedMathMl;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (!getGlobal().instance) {
|
|
653
|
+
getGlobal().instance = bootstrap(renderOpts);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (!el) {
|
|
657
|
+
log('el is undefined');
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (el instanceof Element && (_getGlobal$instance = getGlobal().instance) != null && _getGlobal$instance.Typeset) {
|
|
662
|
+
getGlobal().instance.Typeset(el);
|
|
663
|
+
} else if (el.length && (_getGlobal$instance2 = getGlobal().instance) != null && _getGlobal$instance2.Typeset) {
|
|
664
|
+
const arr = Array.from(el);
|
|
665
|
+
getGlobal().instance.Typeset(...arr);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* This style is added to overried default styling of mjx-mspace Mathjax tag
|
|
670
|
+
* In mathjax src code \newline latex gets parsed to <mjx-mspace></mjx-mspace>,
|
|
671
|
+
* but has the default style
|
|
672
|
+
* 'mjx-mspace': {
|
|
673
|
+
"display": 'in-line',
|
|
674
|
+
"text-align": 'left'
|
|
675
|
+
} which prevents it from showing as a newline value
|
|
676
|
+
*/
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
CHTMLmspace.styles = {
|
|
680
|
+
'mjx-mspace': {
|
|
681
|
+
display: 'block',
|
|
682
|
+
'text-align': 'center',
|
|
683
|
+
height: '5px'
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
var mmlToLatex = (mathml => MathMLToLaTeX.convert(mathml));
|
|
688
|
+
|
|
689
|
+
export { mmlToLatex, renderMath, unWrapMath, wrapMath };
|
|
690
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/mstack/chtml.js","../src/mstack/mml.js","../src/mstack/index.js","../src/normalization.js","../src/render-math.js","../src/mml-to-latex.js"],"sourcesContent":["import { CHTMLWrapper } from 'mathjax-full/js/output/chtml/Wrapper';\nimport _ from 'lodash';\n\nconst reduceText = (acc, n) => {\n if (n.node && n.node.kind === 'text') {\n acc += n.node.text;\n }\n return acc;\n};\n\nexport class Line {\n constructor() {\n this.kind = 'line';\n }\n\n get columns() {\n return [];\n }\n}\n\nexport class Row {\n constructor(columns, operator) {\n this.kind = 'row';\n this.operator = operator;\n this.columns = columns;\n }\n\n pad(count, direction = 'right') {\n if (count < this.columns.length) {\n throw new Error('no');\n }\n\n const diff = count - this.columns.length;\n\n const padding = _.times(diff).map(() => '__pad__');\n return direction === 'right' ? [...padding, ...this.columns] : [...this.columns, ...padding];\n }\n}\n\nconst mathNodeToCharArray = (mn) => {\n const text = mn.childNodes.reduce(reduceText, '');\n return text.split('');\n};\n\n/**\n * Convert child a column entry\n * @param {*} child\n * @return an array of column content\n */\nconst toColumnArray = (child) => {\n if (!child || !child.kind) {\n return [];\n }\n\n if (child.kind === 'msrow') {\n throw new Error('msrow in msrow?');\n }\n\n if (child.kind === 'mo') {\n // We are going to treat this operator as a text array.\n // It's probably going to be a decimal point\n // eslint-disable-next-line no-console\n console.warn('mo that is not 1st node in msrow?');\n return mathNodeToCharArray(child);\n // throw new Error('mo must be first child of msrow');\n }\n\n if (child.kind === 'mn') {\n return mathNodeToCharArray(child);\n }\n\n if (child.toCHTML) {\n return child;\n }\n};\n\n/**\n * convert mstack chtml childNodes into a Row\n * @param child chtml child node of mstack\n * @return Row | Line\n */\nconst rowStack = (child) => {\n if (!child || !child.kind) {\n return;\n }\n\n if (child.kind === 'msrow') {\n if (!child.childNodes || child.childNodes.length === 0) {\n return new Row([]);\n }\n const f = _.first(child.childNodes);\n const nodes = f && f.kind === 'mo' ? _.tail(child.childNodes) : child.childNodes;\n\n const columns = _.flatten(nodes.map(toColumnArray));\n\n return new Row(columns, f.kind === 'mo' ? f : undefined);\n }\n\n if (child.kind === 'mn') {\n const columns = mathNodeToCharArray(child);\n return new Row(columns, undefined);\n }\n\n if (child.kind === 'mo') {\n // eslint-disable-next-line no-console\n console.warn('mo on its own row?');\n return new Row([], child);\n }\n\n if (child.kind === 'msline') {\n return new Line();\n }\n\n if (child.toCHTML) {\n return new Row([child]);\n }\n};\n\n/** convert MathJax chtml tree to Row[]\n * @param mstack the root of the mathjax chtml tree\n * @return Row[]\n */\n\nexport const getStackData = (mstack) => {\n if (!mstack || !mstack.childNodes) {\n return [];\n }\n return _.compact(mstack.childNodes.map(rowStack));\n};\n\nexport class CHTMLmstack extends CHTMLWrapper {\n constructor(factory, node, parent = null) {\n super(factory, node, parent);\n\n this.ce = this.adaptor.document.createElement.bind(this.adaptor.document);\n }\n\n toCHTML(parent) {\n const chtml = this.standardCHTMLnode(parent);\n\n const stackData = getStackData(this);\n\n // console.log('stackData', stackData);\n const maxCols = stackData.reduce((acc, r) => {\n if (r && r.columns.length > acc) {\n acc = r.columns.length;\n }\n return acc;\n }, 0);\n\n const table = this.ce('table');\n chtml.appendChild(table);\n\n stackData.forEach((row) => {\n const tr = this.ce('tr');\n table.appendChild(tr);\n\n if (row.kind === 'row') {\n const td = this.ce('td');\n tr.appendChild(td);\n if (row.operator && row.operator.toCHTML) {\n td.setAttribute('class', 'inner');\n row.operator.toCHTML(td);\n } else {\n td.textContent = '';\n }\n\n // align right for now:\n const cols = row.pad(maxCols, 'right');\n cols.forEach((c) => {\n const t = this.ce('td');\n tr.appendChild(t);\n if (c === '__pad__') {\n t.textContent = '';\n } else if (typeof c === 'string') {\n t.textContent = c;\n } else if (c.kind === 'none') {\n t.textContent = '';\n } else if (c.toCHTML) {\n t.setAttribute('class', 'inner');\n c.toCHTML(t);\n }\n });\n } else if (row.kind === 'line') {\n const td = this.ce('td');\n tr.appendChild(td);\n td.setAttribute('colspan', maxCols + 1);\n td.setAttribute('class', 'mjx-line');\n td.textContent = '';\n }\n });\n }\n}\nCHTMLmstack.styles = {\n 'mjx-mstack > table': {\n 'line-height': 'initial',\n border: 'solid 0px red',\n 'border-spacing': '0em',\n 'border-collapse': 'separate',\n },\n 'mjx-mstack > table > tr': {\n 'line-height': 'initial',\n },\n 'mjx-mstack > table > tr > td': {\n // padding: '1.2rem',\n border: 'solid 0px blue',\n 'font-family': 'sans-serif',\n 'line-height': 'initial',\n },\n 'mjx-mstack > table > tr > td.inner': {\n 'font-family': 'inherit',\n },\n 'mjx-mstack > table > tr > .mjx-line': {\n padding: 0,\n 'border-top': 'solid 1px black',\n },\n '.TEX-A': {\n 'font-family': 'MJXZERO, MJXTEX !important',\n },\n};\n","import { AbstractMmlNode } from 'mathjax-full/js/core/MmlTree/MmlNode';\n\nexport class MmlNone extends AbstractMmlNode {\n get kind() {\n return 'none';\n }\n}\n\nexport class MmlMstack extends AbstractMmlNode {\n get kind() {\n return 'mstack';\n }\n}\n\nexport class MmlMsrow extends AbstractMmlNode {\n get kind() {\n return 'msrow';\n }\n}\nexport class MmlMsline extends AbstractMmlNode {\n get kind() {\n return 'msline';\n }\n}\n","import { CHTMLmstack } from './chtml';\nimport { MmlNone, MmlMsline, MmlMstack, MmlMsrow } from './mml';\n\nexport const chtmlNodes = {\n mstack: CHTMLmstack,\n};\n\nexport const mmlNodes = {\n mstack: MmlMstack,\n msline: MmlMsline,\n msrow: MmlMsrow,\n none: MmlNone,\n};\n","export const BracketTypes = {};\n\nBracketTypes.ROUND_BRACKETS = 'round_brackets';\nBracketTypes.SQUARE_BRACKETS = 'square_brackets';\nBracketTypes.DOLLAR = 'dollar';\nBracketTypes.DOUBLE_DOLLAR = 'double_dollar';\n\nconst PAIRS = {\n [BracketTypes.ROUND_BRACKETS]: ['\\\\(', '\\\\)'],\n [BracketTypes.SQUARE_BRACKETS]: ['\\\\[', '\\\\]'],\n [BracketTypes.DOLLAR]: ['$', '$'],\n [BracketTypes.DOUBLE_DOLLAR]: ['$$', '$$'],\n};\n\nexport const wrapMath = (content, wrapType) => {\n if (wrapType === BracketTypes.SQUARE_BRACKETS) {\n console.warn('\\\\[...\\\\] is not supported yet'); // eslint-disable-line\n wrapType = BracketTypes.ROUND_BRACKETS;\n }\n if (wrapType === BracketTypes.DOUBLE_DOLLAR) {\n console.warn('$$...$$ is not supported yet'); // eslint-disable-line\n wrapType = BracketTypes.DOLLAR;\n }\n\n const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];\n return `${start}${content}${end}`;\n};\n\nexport const unWrapMath = (content) => {\n const displayStyleIndex = content.indexOf('\\\\displaystyle');\n if (displayStyleIndex !== -1) {\n console.warn('\\\\displaystyle is not supported - removing'); // eslint-disable-line\n content = content.replace('\\\\displaystyle', '').trim();\n }\n\n if (content.startsWith('$$') && content.endsWith('$$')) {\n console.warn('$$ syntax is not yet supported'); // eslint-disable-line\n return {\n unwrapped: content.substring(2, content.length - 2),\n wrapType: BracketTypes.DOLLAR,\n };\n }\n if (content.startsWith('$') && content.endsWith('$')) {\n return {\n unwrapped: content.substring(1, content.length - 1),\n wrapType: BracketTypes.DOLLAR,\n };\n }\n\n if (content.startsWith('\\\\[') && content.endsWith('\\\\]')) {\n console.warn('\\\\[..\\\\] syntax is not yet supported'); // eslint-disable-line\n return {\n unwrapped: content.substring(2, content.length - 2),\n wrapType: BracketTypes.ROUND_BRACKETS,\n };\n }\n\n if (content.startsWith('\\\\(') && content.endsWith('\\\\)')) {\n return {\n unwrapped: content.substring(2, content.length - 2),\n wrapType: BracketTypes.ROUND_BRACKETS,\n };\n }\n\n return {\n unwrapped: content,\n wrapType: BracketTypes.ROUND_BRACKETS,\n };\n};\n","import { mathjax } from 'mathjax-full/js/mathjax';\nimport { MathJax as globalMathjax } from 'mathjax-full/js/components/global';\nimport { AssistiveMmlHandler } from 'mathjax-full/js/a11y/assistive-mml';\nimport { EnrichHandler } from 'mathjax-full/js/a11y/semantic-enrich';\nimport { MenuHandler } from 'mathjax-full/js/ui/menu/MenuHandler';\nimport { FindMathML } from 'mathjax-full/js/input/mathml/FindMathML';\nimport { MathML } from 'mathjax-full/js/input/mathml';\nimport { TeX } from 'mathjax-full/js/input/tex';\n\nimport { CHTML } from 'mathjax-full/js/output/chtml';\nimport { RegisterHTMLHandler } from 'mathjax-full/js/handlers/html';\nimport { browserAdaptor } from 'mathjax-full/js/adaptors/browserAdaptor';\nimport { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';\nimport { engineReady } from 'speech-rule-engine/js/common/system';\n\nif (typeof window !== 'undefined') {\n RegisterHTMLHandler(browserAdaptor());\n}\n\nlet sreReady = false;\n\nengineReady().then(() => {\n sreReady = true;\n});\n\n// import pkg from '../../package.json';\nimport { mmlNodes, chtmlNodes } from './mstack';\nimport debug from 'debug';\nimport { wrapMath, unWrapMath } from './normalization';\nimport { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';\nimport { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';\nimport { CHTMLWrapperFactory } from 'mathjax-full/js/output/chtml/WrapperFactory';\nimport { CHTMLmspace } from 'mathjax-full/js/output/chtml/Wrappers/mspace';\nimport { HTMLDomStrings } from 'mathjax-full/js/handlers/html/HTMLDomStrings';\n\nconst visitor = new SerializedMmlVisitor();\nconst toMMl = (node) => visitor.visitTree(node);\n\nconst log = debug('pie-lib:math-rendering');\n\nconst NEWLINE_BLOCK_REGEX = /\\\\embed\\{newLine\\}\\[\\]/g;\nconst NEWLINE_LATEX = '\\\\newline ';\n\nconst getGlobal = () => {\n // TODO does it make sense to use version?\n // const key = `${pkg.name}@${pkg.version.split('.')[0]}`;\n // It looks like Ed made this change when he switched from mathjax3 to mathjax-full\n // I think it was supposed to make sure version 1 (using mathjax3) is not used\n // in combination with version 2 (using mathjax-full)\n\n // TODO higher level wrappers use this instance of math-rendering, and if 2 different instances are used, math rendering is not working\n // so I will hardcode this for now until a better solution is found\n const key = '@pie-lib/math-rendering@2';\n\n if (typeof window !== 'undefined') {\n if (!window[key]) {\n window[key] = {};\n }\n return window[key];\n } else {\n return {};\n }\n};\n\n/** Add temporary support for a global singleDollar override\n * <code>\n * // This will enable single dollar rendering\n * window.pie = window.pie || {};\n * window.pie.mathRendering = {useSingleDollar: true };\n * </code>\n */\nconst defaultOpts = () => getGlobal().opts || {};\n\nexport const fixMathElement = (element) => {\n if (element.dataset.mathHandled) {\n return;\n }\n\n let property = 'innerText';\n\n if (element.textContent) {\n property = 'textContent';\n }\n\n if (element[property]) {\n element[property] = wrapMath(unWrapMath(element[property]).unwrapped);\n // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.\n // we need to replace the custom embedded elements with valid latex that Mathjax can understand\n element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);\n element.dataset.mathHandled = true;\n }\n};\n\nexport const fixMathElements = (el = document) => {\n const mathElements = el.querySelectorAll('[data-latex]');\n\n mathElements.forEach((item) => fixMathElement(item));\n};\n\nconst adjustMathMLStyle = (el = document) => {\n const nodes = el.querySelectorAll('math');\n nodes.forEach((node) => node.setAttribute('displaystyle', 'true'));\n};\n\nclass myFindMathML extends FindMathML {\n processMath(set) {\n const adaptor = this.adaptor;\n for (const mml of Array.from(set)) {\n if (adaptor.kind(adaptor.parent(mml)) === 'mjx-assistive-mml') {\n set.delete(mml);\n }\n }\n return super.processMath(set);\n }\n}\n\nconst createMathMLInstance = (opts, docProvided = document) => {\n opts = opts || defaultOpts();\n\n if (opts.useSingleDollar) {\n // eslint-disable-next-line\n console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\\\(...\\\\)');\n }\n\n const packages = AllPackages.filter((name) => name !== 'bussproofs'); // Bussproofs needs an output jax\n\n // The autoload extension predefines all the macros from the extensions that haven't been loaded already\n // so that they automatically load the needed extension when they are first used\n packages.push('autoload');\n\n const macros = {\n parallelogram: '\\\\lower.2em{\\\\Huge\\\\unicode{x25B1}}',\n overarc: '\\\\overparen',\n napprox: '\\\\not\\\\approx',\n longdiv: '\\\\enclose{longdiv}',\n };\n\n const texConfig = opts.useSingleDollar\n ? {\n packages,\n macros,\n inlineMath: [\n ['$', '$'],\n ['\\\\(', '\\\\)'],\n ],\n processEscapes: true,\n }\n : {\n packages,\n macros,\n };\n\n const mmlConfig = {\n parseError: function(node) {\n // function to process parsing errors\n // eslint-disable-next-line no-console\n console.log('error:', node);\n this.error(this.adaptor.textContent(node).replace(/\\n.*/g, ''));\n },\n FindMathML: new myFindMathML(),\n };\n\n let cachedMathjax;\n\n if (globalMathjax && globalMathjax.version !== mathjax.version) {\n // handling other MathJax version on the page\n // replacing it temporarily with the version we have\n window.MathJax._ = window.MathJax._ || {};\n window.MathJax.config = window.MathJax.config || {};\n cachedMathjax = window.MathJax;\n Object.assign(globalMathjax, mathjax);\n }\n\n const fontURL = `https://unpkg.com/mathjax-full@${mathjax.version}/ts/output/chtml/fonts/tex-woff-v2`;\n const htmlConfig = {\n fontURL,\n\n wrapperFactory: new CHTMLWrapperFactory({\n ...CHTMLWrapperFactory.defaultNodes,\n ...chtmlNodes,\n }),\n };\n\n const mml = new MathML(mmlConfig);\n\n const customMmlFactory = new MmlFactory({\n ...MmlFactory.defaultNodes,\n ...mmlNodes,\n });\n const classFactory = EnrichHandler(\n MenuHandler(AssistiveMmlHandler(mathjax.handlers.handlesDocument(docProvided))),\n mml,\n );\n\n const html = classFactory.create(docProvided, {\n compileError: (mj, math, err) => {\n // eslint-disable-next-line no-console\n console.log('bad math?:', math);\n // eslint-disable-next-line no-console\n console.error(err);\n },\n typesetError: function(doc, math, err) {\n // eslint-disable-next-line no-console\n console.log('typeset error');\n // eslint-disable-next-line no-console\n console.error(err);\n doc.typesetError(math, err);\n },\n\n sre: {\n speech: 'deep',\n },\n enrichSpeech: 'deep',\n\n InputJax: [new TeX(texConfig), mml],\n OutputJax: new CHTML(htmlConfig),\n DomStrings: new HTMLDomStrings({\n skipHtmlTags: [\n 'script',\n 'noscript',\n 'style',\n 'textarea',\n 'pre',\n 'code',\n 'annotation',\n 'annotation-xml',\n 'mjx-assistive-mml',\n 'mjx-container',\n ],\n }),\n });\n\n // Note: we must set this *after* mathjax.document (no idea why)\n mml.setMmlFactory(customMmlFactory);\n\n if (cachedMathjax) {\n // if we have a cached version, we replace it here\n window.MathJax = cachedMathjax;\n }\n\n return html;\n};\n\nlet enrichSpeechInitialized = false;\n\nconst bootstrap = (opts) => {\n if (typeof window === 'undefined') {\n return { Typeset: () => ({}) };\n }\n\n const html = createMathMLInstance(opts);\n\n return {\n version: mathjax.version,\n html: html,\n Typeset: function(...elements) {\n const attemptRender = (temporary = false) => {\n let updatedDocument = this.html.findMath(elements.length ? { elements } : {}).compile();\n\n if (!temporary && sreReady) {\n updatedDocument = updatedDocument.enrich();\n }\n\n updatedDocument = updatedDocument\n .getMetrics()\n .typeset()\n .assistiveMml()\n .attachSpeech()\n .addMenu()\n .updateDocument();\n\n if (!enrichSpeechInitialized && typeof updatedDocument.math.list?.next?.data === 'object') {\n enrichSpeechInitialized = true;\n }\n\n try {\n const list = updatedDocument.math.list;\n\n if (list) {\n for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {\n const mathMl = toMMl(item.data.root);\n const parsedMathMl = mathMl.replaceAll('\\n', '');\n\n item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);\n item.data.typesetRoot.setAttribute('tabindex', '-1');\n }\n }\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(e.toString());\n }\n\n updatedDocument.clear();\n };\n\n if (!enrichSpeechInitialized) {\n attemptRender(true);\n }\n\n mathjax.handleRetriesFor(() => {\n attemptRender();\n });\n },\n };\n};\n\nconst renderMath = (el, renderOpts) => {\n if (\n window &&\n window.MathJax &&\n window.MathJax.customKey &&\n window.MathJax.customKey == '@pie-lib/math-rendering-accessible@1'\n ) {\n return;\n }\n\n const isString = typeof el === 'string';\n let executeOn = document.body;\n\n if (isString) {\n const div = document.createElement('div');\n\n div.innerHTML = el;\n executeOn = div;\n }\n\n fixMathElements(executeOn);\n adjustMathMLStyle(executeOn);\n\n if (isString) {\n const html = createMathMLInstance(undefined, executeOn);\n\n const updatedDocument = html\n .findMath()\n .compile()\n .getMetrics()\n .typeset()\n .updateDocument();\n\n const list = updatedDocument.math.list;\n const item = list.next;\n\n if (!item) {\n return '';\n }\n\n const mathMl = toMMl(item.data.root);\n const parsedMathMl = mathMl.replaceAll('\\n', '');\n\n return parsedMathMl;\n }\n\n if (!getGlobal().instance) {\n getGlobal().instance = bootstrap(renderOpts);\n }\n\n if (!el) {\n log('el is undefined');\n return;\n }\n\n if (el instanceof Element && getGlobal().instance?.Typeset) {\n getGlobal().instance.Typeset(el);\n } else if (el.length && getGlobal().instance?.Typeset) {\n const arr = Array.from(el);\n getGlobal().instance.Typeset(...arr);\n }\n};\n\n/**\n * This style is added to overried default styling of mjx-mspace Mathjax tag\n * In mathjax src code \\newline latex gets parsed to <mjx-mspace></mjx-mspace>,\n * but has the default style\n * 'mjx-mspace': {\n \"display\": 'in-line',\n \"text-align\": 'left'\n} which prevents it from showing as a newline value\n */\nCHTMLmspace.styles = {\n 'mjx-mspace': {\n display: 'block',\n 'text-align': 'center',\n height: '5px',\n },\n};\n\nexport default renderMath;\n","import { MathMLToLaTeX } from '@pie-framework/mathml-to-latex';\nexport default (mathml) => MathMLToLaTeX.convert(mathml);\n"],"names":["reduceText","acc","n","node","kind","text","Line","constructor","columns","Row","operator","pad","count","direction","length","Error","diff","padding","_","times","map","mathNodeToCharArray","mn","childNodes","reduce","split","toColumnArray","child","console","warn","toCHTML","rowStack","f","first","nodes","tail","flatten","undefined","getStackData","mstack","compact","CHTMLmstack","CHTMLWrapper","factory","parent","ce","adaptor","document","createElement","bind","chtml","standardCHTMLnode","stackData","maxCols","r","table","appendChild","forEach","row","tr","td","setAttribute","textContent","cols","c","t","styles","border","MmlNone","AbstractMmlNode","MmlMstack","MmlMsrow","MmlMsline","chtmlNodes","mmlNodes","msline","msrow","none","BracketTypes","ROUND_BRACKETS","SQUARE_BRACKETS","DOLLAR","DOUBLE_DOLLAR","PAIRS","wrapMath","content","wrapType","start","end","unWrapMath","displayStyleIndex","indexOf","replace","trim","startsWith","endsWith","unwrapped","substring","window","RegisterHTMLHandler","browserAdaptor","sreReady","engineReady","then","visitor","SerializedMmlVisitor","toMMl","visitTree","log","debug","NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","getGlobal","key","defaultOpts","opts","fixMathElement","element","dataset","mathHandled","property","fixMathElements","el","mathElements","querySelectorAll","item","adjustMathMLStyle","myFindMathML","FindMathML","processMath","set","mml","Array","from","delete","createMathMLInstance","docProvided","useSingleDollar","packages","AllPackages","filter","name","push","macros","parallelogram","overarc","napprox","longdiv","texConfig","inlineMath","processEscapes","mmlConfig","parseError","error","cachedMathjax","globalMathjax","version","mathjax","MathJax","config","Object","assign","fontURL","htmlConfig","wrapperFactory","CHTMLWrapperFactory","defaultNodes","MathML","customMmlFactory","MmlFactory","classFactory","EnrichHandler","MenuHandler","AssistiveMmlHandler","handlers","handlesDocument","html","create","compileError","mj","math","err","typesetError","doc","sre","speech","enrichSpeech","InputJax","TeX","OutputJax","CHTML","DomStrings","HTMLDomStrings","skipHtmlTags","setMmlFactory","enrichSpeechInitialized","bootstrap","Typeset","elements","attemptRender","temporary","updatedDocument","findMath","compile","enrich","getMetrics","typeset","assistiveMml","attachSpeech","addMenu","updateDocument","list","next","data","mathMl","root","parsedMathMl","replaceAll","typesetRoot","e","toString","clear","handleRetriesFor","renderMath","renderOpts","customKey","isString","executeOn","body","div","innerHTML","instance","Element","arr","CHTMLmspace","display","height","mathml","MathMLToLaTeX","convert"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,UAAU,GAAG,CAACC,GAAD,EAAMC,CAAN,KAAY;AAC7B,EAAA,IAAIA,CAAC,CAACC,IAAF,IAAUD,CAAC,CAACC,IAAF,CAAOC,IAAP,KAAgB,MAA9B,EAAsC;AACpCH,IAAAA,GAAG,IAAIC,CAAC,CAACC,IAAF,CAAOE,IAAd;AACD,EAAA;;AACD,EAAA,OAAOJ,GAAP;AACD,CALD;;AAOO,MAAMK,IAAN,CAAW;AAChBC,EAAAA,WAAW,GAAG;AACZ,IAAA,IAAA,CAAKH,IAAL,GAAY,MAAZ;AACD,EAAA;;AAEU,EAAA,IAAPI,OAAO,GAAG;AACZ,IAAA,OAAO,EAAP;AACD,EAAA;;AAPe;AAUX,MAAMC,GAAN,CAAU;AACfF,EAAAA,WAAW,CAACC,OAAD,EAAUE,QAAV,EAAoB;AAC7B,IAAA,IAAA,CAAKN,IAAL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C1DrF,IAAAA,SAAS,EAAA,CAAGuH,QAAZ,CAAqBlC,OAArB,CAA6B3E,EAA7B,CAAA;AACD,EAAA,CAFD,MAEO,IAAIA,EAAE,CAAC5G,MAAH,IAAA,CAAA,oBAAA,GAAakG,SAAS,EAAA,CAAGuH,QAAzB,KAAA,IAAA,IAAa,oBAAA,CAAsBlC,OAAvC,EAAgD;AACrD,IAAA,MAAMoC,GAAG,GAAGrG,KAAK,CAACC,IAAN,CAAWX,EAAX,CAAZ;AACAV,IAAAA,SAAS,EAAA,CAAGuH,QAAZ,CAAqBlC,OAArB,CAA6B,GAAGoC,GAAhC,CAAA;AACD,EAAA;AACF;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACAC,WAAW,CAACxK,MAAZ,GAAqB;AACnB,EAAA,YAAA,EAAc;AACZyK,IAAAA,OAAO,EAAE,OADG;AAEZ,IAAA,YAAA,EAAc,QAFF;AAGZC,IAAAA,MAAM,EAAE;AAHI;AADK,CAArB;;ACzXA,iBAAA,CAAgBC,MAAD,IAAYC,aAAa,CAACC,OAAd,CAAsBF,MAAtB,CAA3B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/math-rendering",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.2",
|
|
4
4
|
"description": "math rendering utilities",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
"mathjax-full": "3.2.2",
|
|
17
17
|
"react": "^16.8.1"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
20
|
-
"scripts": {}
|
|
19
|
+
"gitHead": "8a327571bd64249e4c88c0c8e750d16d6213f535",
|
|
20
|
+
"scripts": {},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./esm/index.js",
|
|
24
|
+
"require": "./lib/index.js",
|
|
25
|
+
"default": "./esm/index.js"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
21
28
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
Copyright 2019 CoreSpring Inc
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
-
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|