@pie-lib/math-rendering 3.2.1-next.1 → 3.2.2-next.1642
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.json +1 -672
- package/CHANGELOG.md +207 -19
- package/NEXT.CHANGELOG.json +1 -0
- package/lib/render-math.js +156 -76
- package/lib/render-math.js.map +1 -1
- package/package.json +5 -4
- package/src/__tests__/mml-to-latex.test.js +14 -0
- package/src/__tests__/normalization.test.js +50 -0
- package/src/__tests__/render-math.test.js +155 -0
- package/src/mstack/__tests__/__snapshots__/chtml.test.js.snap +9 -0
- package/src/mstack/__tests__/chtml.test.js +104 -0
- package/src/render-math.js +127 -71
- package/playground/demo.html +0 -958
- package/playground/demo.js +0 -108
- package/playground/main.html +0 -158
- package/playground/main.js +0 -16
- package/playground/webpack.config.js +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -3,92 +3,280 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [3.
|
|
6
|
+
# [3.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.16.0...@pie-lib/math-rendering@3.17.0) (2025-09-18)
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
*
|
|
11
|
+
* **math-rendering:** move mathjax-full back to dependencies ([3073e44](https://github.com/pie-framework/pie-lib/commit/3073e444419d8e52d451df750e8d1d604f23bd3f))
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
# [3.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.15.0...@pie-lib/math-rendering@3.16.0) (2025-09-18)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [3.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.15.0) (2025-09-18)
|
|
18
26
|
|
|
19
27
|
|
|
20
28
|
### Bug Fixes
|
|
21
29
|
|
|
22
|
-
*
|
|
30
|
+
* fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
|
|
23
31
|
|
|
24
32
|
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [3.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.13.0...@pie-lib/math-rendering@3.14.0) (2025-09-17)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
25
44
|
|
|
26
45
|
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [3.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.12.0...@pie-lib/math-rendering@3.13.0) (2025-09-17)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# [3.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.11.1...@pie-lib/math-rendering@3.12.0) (2025-09-17)
|
|
58
|
+
|
|
59
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [3.11.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.11.1) (2025-08-11)
|
|
29
66
|
|
|
30
67
|
|
|
31
68
|
### Bug Fixes
|
|
32
69
|
|
|
33
|
-
*
|
|
70
|
+
* fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
|
|
34
71
|
|
|
35
72
|
|
|
73
|
+
### Features
|
|
74
|
+
|
|
75
|
+
* split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
|
|
76
|
+
|
|
36
77
|
|
|
37
78
|
|
|
38
79
|
|
|
39
|
-
# [3.1.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.0.0...@pie-lib/math-rendering@3.1.0) (2023-09-20)
|
|
40
80
|
|
|
81
|
+
# [3.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.11.0) (2025-08-07)
|
|
41
82
|
|
|
42
83
|
### Features
|
|
43
84
|
|
|
44
|
-
|
|
85
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
45
86
|
|
|
87
|
+
# [3.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.10.0) (2025-07-31)
|
|
46
88
|
|
|
89
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
47
90
|
|
|
91
|
+
# [3.9.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.9.0) (2025-07-31)
|
|
48
92
|
|
|
93
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
49
94
|
|
|
50
|
-
# [3.
|
|
95
|
+
# [3.8.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.8.0) (2025-07-31)
|
|
51
96
|
|
|
97
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
52
98
|
|
|
53
|
-
|
|
99
|
+
# [3.7.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.7.0) (2025-07-31)
|
|
54
100
|
|
|
55
|
-
|
|
101
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
56
102
|
|
|
103
|
+
# [3.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.6.0) (2025-07-31)
|
|
57
104
|
|
|
58
|
-
|
|
105
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
106
|
+
|
|
107
|
+
# [3.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.5.0) (2025-07-31)
|
|
108
|
+
|
|
109
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
59
110
|
|
|
60
|
-
|
|
111
|
+
# [3.7.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.7.0) (2025-07-31)
|
|
61
112
|
|
|
113
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
62
114
|
|
|
115
|
+
# [3.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.6.0) (2025-07-31)
|
|
63
116
|
|
|
117
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
64
118
|
|
|
119
|
+
# [3.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.5.0) (2025-07-31)
|
|
65
120
|
|
|
66
|
-
|
|
121
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
67
122
|
|
|
123
|
+
# [3.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.6.0) (2025-07-31)
|
|
68
124
|
|
|
69
|
-
|
|
125
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
70
126
|
|
|
71
|
-
|
|
127
|
+
# [3.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.5.0) (2025-07-31)
|
|
72
128
|
|
|
129
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
73
130
|
|
|
131
|
+
# [3.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.4.0) (2025-07-31)
|
|
74
132
|
|
|
133
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
75
134
|
|
|
135
|
+
# [3.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.4.0) (2025-07-31)
|
|
76
136
|
|
|
77
|
-
|
|
137
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
138
|
+
|
|
139
|
+
# [3.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.5.0) (2025-07-31)
|
|
78
140
|
|
|
79
141
|
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
80
142
|
|
|
143
|
+
# [3.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.4.0) (2025-07-31)
|
|
81
144
|
|
|
145
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
82
146
|
|
|
147
|
+
# [3.3.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.8) (2025-07-25)
|
|
83
148
|
|
|
149
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
84
150
|
|
|
85
|
-
|
|
151
|
+
# [3.3.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.7) (2025-07-25)
|
|
152
|
+
|
|
153
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
154
|
+
|
|
155
|
+
# [3.3.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.7) (2025-07-25)
|
|
156
|
+
|
|
157
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
158
|
+
|
|
159
|
+
# [3.3.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.6) (2025-07-25)
|
|
160
|
+
|
|
161
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
162
|
+
|
|
163
|
+
# [3.3.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.6) (2025-07-25)
|
|
164
|
+
|
|
165
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
166
|
+
|
|
167
|
+
# [3.3.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.5) (2025-07-25)
|
|
86
168
|
|
|
87
169
|
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
88
170
|
|
|
171
|
+
# [3.3.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.5) (2025-07-25)
|
|
89
172
|
|
|
173
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
90
174
|
|
|
175
|
+
# [3.3.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.4) (2025-07-25)
|
|
176
|
+
|
|
177
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
91
178
|
|
|
179
|
+
# [3.3.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.3) (2025-07-25)
|
|
180
|
+
|
|
181
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
182
|
+
|
|
183
|
+
# [3.3.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.4) (2025-07-23)
|
|
184
|
+
|
|
185
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
186
|
+
|
|
187
|
+
# [3.3.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.3) (2025-07-23)
|
|
188
|
+
|
|
189
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
190
|
+
|
|
191
|
+
# [3.3.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.3) (2025-07-20)
|
|
192
|
+
|
|
193
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
194
|
+
|
|
195
|
+
# [3.3.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.2) (2025-07-20)
|
|
196
|
+
|
|
197
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
198
|
+
|
|
199
|
+
# [3.3.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.1) (2025-07-20)
|
|
200
|
+
|
|
201
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
202
|
+
|
|
203
|
+
# [3.3.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.2) (2025-07-20)
|
|
204
|
+
|
|
205
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
206
|
+
|
|
207
|
+
# [3.3.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.1) (2025-07-20)
|
|
208
|
+
|
|
209
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
210
|
+
|
|
211
|
+
# [3.3.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.1) (2025-07-20)
|
|
212
|
+
|
|
213
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
214
|
+
|
|
215
|
+
# [3.3.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.0) (2025-07-20)
|
|
216
|
+
|
|
217
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
218
|
+
|
|
219
|
+
# [3.4.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.4.0-beta.0) (2025-07-15)
|
|
220
|
+
|
|
221
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
222
|
+
|
|
223
|
+
# [3.3.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.1...@pie-lib/math-rendering@3.3.0-beta.0) (2025-07-15)
|
|
224
|
+
|
|
225
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
226
|
+
|
|
227
|
+
## [3.2.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.2.0...@pie-lib/math-rendering@3.2.1) (2023-10-01)
|
|
228
|
+
|
|
229
|
+
### Bug Fixes
|
|
230
|
+
|
|
231
|
+
- revert mathml-to-latex version as it seems to break math rendering ([46e841c](https://github.com/pie-framework/pie-lib/commit/46e841c00c2a04ff0e3442625870b3b457571a8e))
|
|
232
|
+
|
|
233
|
+
# [3.2.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.1.2...@pie-lib/math-rendering@3.2.0) (2023-09-27)
|
|
234
|
+
|
|
235
|
+
### Features
|
|
236
|
+
|
|
237
|
+
- update version ([f716545](https://github.com/pie-framework/pie-lib/commit/f716545d526dc856e2160619650787273a993f27))
|
|
238
|
+
|
|
239
|
+
## [3.1.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.1.1...@pie-lib/math-rendering@3.1.2) (2023-09-27)
|
|
240
|
+
|
|
241
|
+
### Bug Fixes
|
|
242
|
+
|
|
243
|
+
- force publish ([489a242](https://github.com/pie-framework/pie-lib/commit/489a2421c109fb202b778680f1b57b942e49c86a))
|
|
244
|
+
|
|
245
|
+
## [3.1.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.1.0...@pie-lib/math-rendering@3.1.1) (2023-09-25)
|
|
246
|
+
|
|
247
|
+
### Bug Fixes
|
|
248
|
+
|
|
249
|
+
- update mathml-to-latex version PD-3182, PD-3184 ([c019296](https://github.com/pie-framework/pie-lib/commit/c0192965a3a045e13993a3301dfc35e7e314a592))
|
|
250
|
+
|
|
251
|
+
# [3.1.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@3.0.0...@pie-lib/math-rendering@3.1.0) (2023-09-20)
|
|
252
|
+
|
|
253
|
+
### Features
|
|
254
|
+
|
|
255
|
+
- use forked mathml-to-latex library, as it contains fixes PD-3011 ([8949ac2](https://github.com/pie-framework/pie-lib/commit/8949ac2ddf6664bf437a35dbe21555f18ac77426))
|
|
256
|
+
|
|
257
|
+
# [3.0.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@2.5.18...@pie-lib/math-rendering@3.0.0) (2023-09-20)
|
|
258
|
+
|
|
259
|
+
### Bug Fixes
|
|
260
|
+
|
|
261
|
+
- update mathml-to-latex version ([1d101d2](https://github.com/pie-framework/pie-lib/commit/1d101d22298bd480a5aec638e4c9708d5aa52ce4))
|
|
262
|
+
|
|
263
|
+
### BREAKING CHANGES
|
|
264
|
+
|
|
265
|
+
- updated mathml-to-latex version.
|
|
266
|
+
|
|
267
|
+
## [2.5.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@2.5.17...@pie-lib/math-rendering@2.5.18) (2023-09-14)
|
|
268
|
+
|
|
269
|
+
### Bug Fixes
|
|
270
|
+
|
|
271
|
+
- force v1.2.0 of mathml-to-latex, as v1.3.0 contains a braking change ([4792ed9](https://github.com/pie-framework/pie-lib/commit/4792ed965608ee5ff4c872e69dee9b3b59261cf0))
|
|
272
|
+
|
|
273
|
+
## [2.5.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@2.5.16...@pie-lib/math-rendering@2.5.17) (2023-06-24)
|
|
274
|
+
|
|
275
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
276
|
+
|
|
277
|
+
## [2.5.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@2.5.15...@pie-lib/math-rendering@2.5.16) (2023-06-13)
|
|
278
|
+
|
|
279
|
+
**Note:** Version bump only for package @pie-lib/math-rendering
|
|
92
280
|
|
|
93
281
|
## [2.5.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-rendering@2.5.14...@pie-lib/math-rendering@2.5.15) (2023-06-12)
|
|
94
282
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
package/lib/render-math.js
CHANGED
|
@@ -13,8 +13,30 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
16
28
|
var _mathjax = require("mathjax-full/js/mathjax");
|
|
17
29
|
|
|
30
|
+
var _global = require("mathjax-full/js/components/global");
|
|
31
|
+
|
|
32
|
+
var _assistiveMml = require("mathjax-full/js/a11y/assistive-mml");
|
|
33
|
+
|
|
34
|
+
var _semanticEnrich = require("mathjax-full/js/a11y/semantic-enrich");
|
|
35
|
+
|
|
36
|
+
var _MenuHandler = require("mathjax-full/js/ui/menu/MenuHandler");
|
|
37
|
+
|
|
38
|
+
var _FindMathML2 = require("mathjax-full/js/input/mathml/FindMathML");
|
|
39
|
+
|
|
18
40
|
var _mathml = require("mathjax-full/js/input/mathml");
|
|
19
41
|
|
|
20
42
|
var _tex = require("mathjax-full/js/input/tex");
|
|
@@ -27,7 +49,7 @@ var _browserAdaptor = require("mathjax-full/js/adaptors/browserAdaptor");
|
|
|
27
49
|
|
|
28
50
|
var _AllPackages = require("mathjax-full/js/input/tex/AllPackages");
|
|
29
51
|
|
|
30
|
-
var
|
|
52
|
+
var _system = require("speech-rule-engine/js/common/system");
|
|
31
53
|
|
|
32
54
|
var _mstack = require("./mstack");
|
|
33
55
|
|
|
@@ -43,14 +65,25 @@ var _WrapperFactory = require("mathjax-full/js/output/chtml/WrapperFactory");
|
|
|
43
65
|
|
|
44
66
|
var _mspace = require("mathjax-full/js/output/chtml/Wrappers/mspace");
|
|
45
67
|
|
|
68
|
+
var _HTMLDomStrings = require("mathjax-full/js/handlers/html/HTMLDomStrings");
|
|
69
|
+
|
|
46
70
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
71
|
|
|
48
72
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
73
|
|
|
74
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
75
|
+
|
|
76
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
77
|
+
|
|
50
78
|
if (typeof window !== 'undefined') {
|
|
51
79
|
(0, _html.RegisterHTMLHandler)((0, _browserAdaptor.browserAdaptor)());
|
|
52
80
|
}
|
|
53
81
|
|
|
82
|
+
var sreReady = false;
|
|
83
|
+
(0, _system.engineReady)().then(function () {
|
|
84
|
+
sreReady = true;
|
|
85
|
+
}); // import pkg from '../../package.json';
|
|
86
|
+
|
|
54
87
|
var visitor = new _SerializedMmlVisitor.SerializedMmlVisitor();
|
|
55
88
|
|
|
56
89
|
var toMMl = function toMMl(node) {
|
|
@@ -62,7 +95,14 @@ var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
|
62
95
|
var NEWLINE_LATEX = '\\newline ';
|
|
63
96
|
|
|
64
97
|
var getGlobal = function getGlobal() {
|
|
65
|
-
|
|
98
|
+
// TODO does it make sense to use version?
|
|
99
|
+
// const key = `${pkg.name}@${pkg.version.split('.')[0]}`;
|
|
100
|
+
// It looks like Ed made this change when he switched from mathjax3 to mathjax-full
|
|
101
|
+
// I think it was supposed to make sure version 1 (using mathjax3) is not used
|
|
102
|
+
// in combination with version 2 (using mathjax-full)
|
|
103
|
+
// TODO higher level wrappers use this instance of math-rendering, and if 2 different instances are used, math rendering is not working
|
|
104
|
+
// so I will hardcode this for now until a better solution is found
|
|
105
|
+
var key = '@pie-lib/math-rendering@2';
|
|
66
106
|
|
|
67
107
|
if (typeof window !== 'undefined') {
|
|
68
108
|
if (!window[key]) {
|
|
@@ -127,6 +167,35 @@ var adjustMathMLStyle = function adjustMathMLStyle() {
|
|
|
127
167
|
});
|
|
128
168
|
};
|
|
129
169
|
|
|
170
|
+
var myFindMathML = /*#__PURE__*/function (_FindMathML) {
|
|
171
|
+
(0, _inherits2["default"])(myFindMathML, _FindMathML);
|
|
172
|
+
|
|
173
|
+
var _super = _createSuper(myFindMathML);
|
|
174
|
+
|
|
175
|
+
function myFindMathML() {
|
|
176
|
+
(0, _classCallCheck2["default"])(this, myFindMathML);
|
|
177
|
+
return _super.apply(this, arguments);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
(0, _createClass2["default"])(myFindMathML, [{
|
|
181
|
+
key: "processMath",
|
|
182
|
+
value: function processMath(set) {
|
|
183
|
+
var adaptor = this.adaptor;
|
|
184
|
+
|
|
185
|
+
for (var _i = 0, _Array$from = Array.from(set); _i < _Array$from.length; _i++) {
|
|
186
|
+
var mml = _Array$from[_i];
|
|
187
|
+
|
|
188
|
+
if (adaptor.kind(adaptor.parent(mml)) === 'mjx-assistive-mml') {
|
|
189
|
+
set["delete"](mml);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(myFindMathML.prototype), "processMath", this).call(this, set);
|
|
194
|
+
}
|
|
195
|
+
}]);
|
|
196
|
+
return myFindMathML;
|
|
197
|
+
}(_FindMathML2.FindMathML);
|
|
198
|
+
|
|
130
199
|
var createMathMLInstance = function createMathMLInstance(opts) {
|
|
131
200
|
var docProvided = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
132
201
|
opts = opts || defaultOpts();
|
|
@@ -154,68 +223,40 @@ var createMathMLInstance = function createMathMLInstance(opts) {
|
|
|
154
223
|
packages: packages,
|
|
155
224
|
macros: macros,
|
|
156
225
|
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
157
|
-
processEscapes: true
|
|
158
|
-
options: {
|
|
159
|
-
enableExplorer: true,
|
|
160
|
-
enableAssistiveMml: true,
|
|
161
|
-
a11y: {
|
|
162
|
-
speech: true,
|
|
163
|
-
braille: true,
|
|
164
|
-
subtitles: true
|
|
165
|
-
},
|
|
166
|
-
sre: {
|
|
167
|
-
domain: 'default',
|
|
168
|
-
style: 'default',
|
|
169
|
-
locale: 'en'
|
|
170
|
-
}
|
|
171
|
-
}
|
|
226
|
+
processEscapes: true
|
|
172
227
|
} : {
|
|
173
228
|
packages: packages,
|
|
174
|
-
macros: macros
|
|
175
|
-
options: {
|
|
176
|
-
enableExplorer: true,
|
|
177
|
-
enableAssistiveMml: true,
|
|
178
|
-
a11y: {
|
|
179
|
-
speech: true,
|
|
180
|
-
braille: true,
|
|
181
|
-
subtitles: true
|
|
182
|
-
},
|
|
183
|
-
sre: {
|
|
184
|
-
domain: 'default',
|
|
185
|
-
style: 'default',
|
|
186
|
-
locale: 'en'
|
|
187
|
-
}
|
|
188
|
-
}
|
|
229
|
+
macros: macros
|
|
189
230
|
};
|
|
190
231
|
var mmlConfig = {
|
|
191
|
-
options: {
|
|
192
|
-
a11y: {
|
|
193
|
-
speech: true,
|
|
194
|
-
braille: true,
|
|
195
|
-
subtitles: true
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
232
|
parseError: function parseError(node) {
|
|
199
233
|
// function to process parsing errors
|
|
200
234
|
// eslint-disable-next-line no-console
|
|
201
235
|
console.log('error:', node);
|
|
202
236
|
this.error(this.adaptor.textContent(node).replace(/\n.*/g, ''));
|
|
203
|
-
}
|
|
237
|
+
},
|
|
238
|
+
FindMathML: new myFindMathML()
|
|
204
239
|
};
|
|
240
|
+
var cachedMathjax;
|
|
241
|
+
|
|
242
|
+
if (_global.MathJax && _global.MathJax.version !== _mathjax.mathjax.version) {
|
|
243
|
+
// handling other MathJax version on the page
|
|
244
|
+
// replacing it temporarily with the version we have
|
|
245
|
+
window.MathJax._ = window.MathJax._ || {};
|
|
246
|
+
window.MathJax.config = window.MathJax.config || {};
|
|
247
|
+
cachedMathjax = window.MathJax;
|
|
248
|
+
Object.assign(_global.MathJax, _mathjax.mathjax);
|
|
249
|
+
}
|
|
250
|
+
|
|
205
251
|
var fontURL = "https://unpkg.com/mathjax-full@".concat(_mathjax.mathjax.version, "/ts/output/chtml/fonts/tex-woff-v2");
|
|
206
252
|
var htmlConfig = {
|
|
207
253
|
fontURL: fontURL,
|
|
208
|
-
wrapperFactory: new _WrapperFactory.CHTMLWrapperFactory(_objectSpread(_objectSpread({}, _WrapperFactory.CHTMLWrapperFactory.defaultNodes), _mstack.chtmlNodes))
|
|
209
|
-
options: {
|
|
210
|
-
renderActions: {
|
|
211
|
-
assistiveMml: [['AssistiveMmlHandler']]
|
|
212
|
-
}
|
|
213
|
-
}
|
|
254
|
+
wrapperFactory: new _WrapperFactory.CHTMLWrapperFactory(_objectSpread(_objectSpread({}, _WrapperFactory.CHTMLWrapperFactory.defaultNodes), _mstack.chtmlNodes))
|
|
214
255
|
};
|
|
215
256
|
var mml = new _mathml.MathML(mmlConfig);
|
|
216
257
|
var customMmlFactory = new _MmlFactory.MmlFactory(_objectSpread(_objectSpread({}, _MmlFactory.MmlFactory.defaultNodes), _mstack.mmlNodes));
|
|
217
|
-
|
|
218
|
-
var html =
|
|
258
|
+
var classFactory = (0, _semanticEnrich.EnrichHandler)((0, _MenuHandler.MenuHandler)((0, _assistiveMml.AssistiveMmlHandler)(_mathjax.mathjax.handlers.handlesDocument(docProvided))), mml);
|
|
259
|
+
var html = classFactory.create(docProvided, {
|
|
219
260
|
compileError: function compileError(mj, math, err) {
|
|
220
261
|
// eslint-disable-next-line no-console
|
|
221
262
|
console.log('bad math?:', math); // eslint-disable-next-line no-console
|
|
@@ -229,25 +270,29 @@ var createMathMLInstance = function createMathMLInstance(opts) {
|
|
|
229
270
|
console.error(err);
|
|
230
271
|
doc.typesetError(math, err);
|
|
231
272
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
menuOptions: {
|
|
235
|
-
settings: {
|
|
236
|
-
assistiveMml: true,
|
|
237
|
-
collapsible: true,
|
|
238
|
-
explorer: true
|
|
239
|
-
}
|
|
240
|
-
}
|
|
273
|
+
sre: {
|
|
274
|
+
speech: 'deep'
|
|
241
275
|
},
|
|
276
|
+
enrichSpeech: 'deep',
|
|
242
277
|
InputJax: [new _tex.TeX(texConfig), mml],
|
|
243
|
-
OutputJax: new _chtml.CHTML(htmlConfig)
|
|
278
|
+
OutputJax: new _chtml.CHTML(htmlConfig),
|
|
279
|
+
DomStrings: new _HTMLDomStrings.HTMLDomStrings({
|
|
280
|
+
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code', 'annotation', 'annotation-xml', 'mjx-assistive-mml', 'mjx-container']
|
|
281
|
+
})
|
|
244
282
|
}); // Note: we must set this *after* mathjax.document (no idea why)
|
|
245
283
|
|
|
246
|
-
|
|
247
284
|
mml.setMmlFactory(customMmlFactory);
|
|
285
|
+
|
|
286
|
+
if (cachedMathjax) {
|
|
287
|
+
// if we have a cached version, we replace it here
|
|
288
|
+
window.MathJax = cachedMathjax;
|
|
289
|
+
}
|
|
290
|
+
|
|
248
291
|
return html;
|
|
249
292
|
};
|
|
250
293
|
|
|
294
|
+
var enrichSpeechInitialized = false;
|
|
295
|
+
|
|
251
296
|
var bootstrap = function bootstrap(opts) {
|
|
252
297
|
if (typeof window === 'undefined') {
|
|
253
298
|
return {
|
|
@@ -262,33 +307,68 @@ var bootstrap = function bootstrap(opts) {
|
|
|
262
307
|
version: _mathjax.mathjax.version,
|
|
263
308
|
html: html,
|
|
264
309
|
Typeset: function Typeset() {
|
|
310
|
+
var _this = this;
|
|
311
|
+
|
|
265
312
|
for (var _len = arguments.length, elements = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
266
313
|
elements[_key] = arguments[_key];
|
|
267
314
|
}
|
|
268
315
|
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
|
|
316
|
+
var attemptRender = function attemptRender() {
|
|
317
|
+
var _updatedDocument$math, _updatedDocument$math2;
|
|
318
|
+
|
|
319
|
+
var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
272
320
|
|
|
273
|
-
|
|
274
|
-
|
|
321
|
+
var updatedDocument = _this.html.findMath(elements.length ? {
|
|
322
|
+
elements: elements
|
|
323
|
+
} : {}).compile();
|
|
275
324
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
var parsedMathMl = mathMl.replaceAll('\n', '');
|
|
279
|
-
item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
|
|
325
|
+
if (!temporary && sreReady) {
|
|
326
|
+
updatedDocument = updatedDocument.enrich();
|
|
280
327
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
328
|
+
|
|
329
|
+
updatedDocument = updatedDocument.getMetrics().typeset().assistiveMml().attachSpeech().addMenu().updateDocument();
|
|
330
|
+
|
|
331
|
+
if (!enrichSpeechInitialized && (0, _typeof2["default"])((_updatedDocument$math = updatedDocument.math.list) === null || _updatedDocument$math === void 0 ? void 0 : (_updatedDocument$math2 = _updatedDocument$math.next) === null || _updatedDocument$math2 === void 0 ? void 0 : _updatedDocument$math2.data) === 'object') {
|
|
332
|
+
enrichSpeechInitialized = true;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
try {
|
|
336
|
+
var list = updatedDocument.math.list;
|
|
337
|
+
|
|
338
|
+
if (list) {
|
|
339
|
+
for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
|
|
340
|
+
var mathMl = toMMl(item.data.root);
|
|
341
|
+
var parsedMathMl = mathMl.replaceAll('\n', '');
|
|
342
|
+
item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
|
|
343
|
+
item.data.typesetRoot.setAttribute('tabindex', '-1');
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
} catch (e) {
|
|
347
|
+
// eslint-disable-next-line no-console
|
|
348
|
+
console.error(e.toString());
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
updatedDocument.clear();
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
if (!enrichSpeechInitialized) {
|
|
355
|
+
attemptRender(true);
|
|
284
356
|
}
|
|
285
357
|
|
|
286
|
-
|
|
358
|
+
_mathjax.mathjax.handleRetriesFor(function () {
|
|
359
|
+
attemptRender();
|
|
360
|
+
});
|
|
287
361
|
}
|
|
288
362
|
};
|
|
289
363
|
};
|
|
290
364
|
|
|
291
365
|
var renderMath = function renderMath(el, renderOpts) {
|
|
366
|
+
var _getGlobal$instance, _getGlobal$instance2;
|
|
367
|
+
|
|
368
|
+
if (window && window.MathJax && window.MathJax.customKey && window.MathJax.customKey == '@pie-lib/math-rendering-accessible@1') {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
292
372
|
var isString = typeof el === 'string';
|
|
293
373
|
var executeOn = document.body;
|
|
294
374
|
|
|
@@ -325,14 +405,14 @@ var renderMath = function renderMath(el, renderOpts) {
|
|
|
325
405
|
return;
|
|
326
406
|
}
|
|
327
407
|
|
|
328
|
-
if (el instanceof Element) {
|
|
408
|
+
if (el instanceof Element && (_getGlobal$instance = getGlobal().instance) !== null && _getGlobal$instance !== void 0 && _getGlobal$instance.Typeset) {
|
|
329
409
|
getGlobal().instance.Typeset(el);
|
|
330
|
-
} else if (el.length) {
|
|
331
|
-
var _getGlobal$
|
|
410
|
+
} else if (el.length && (_getGlobal$instance2 = getGlobal().instance) !== null && _getGlobal$instance2 !== void 0 && _getGlobal$instance2.Typeset) {
|
|
411
|
+
var _getGlobal$instance3;
|
|
332
412
|
|
|
333
413
|
var arr = Array.from(el);
|
|
334
414
|
|
|
335
|
-
(_getGlobal$
|
|
415
|
+
(_getGlobal$instance3 = getGlobal().instance).Typeset.apply(_getGlobal$instance3, (0, _toConsumableArray2["default"])(arr));
|
|
336
416
|
}
|
|
337
417
|
};
|
|
338
418
|
/**
|