katex 0.18.6 → 0.18.8
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/README.md +3 -3
- package/contrib/copy-tex/README.md +2 -2
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +3 -3
- package/dist/katex-swap.css +5 -1
- package/dist/katex-swap.min.css +1 -1
- package/dist/katex.css +5 -1
- package/dist/katex.js +44 -3
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +38 -3
- package/package.json +1 -1
- package/src/environments/array.ts +4 -2
- package/src/functions/reflectbox.ts +43 -0
- package/src/functions.ts +1 -0
- package/src/macros.ts +6 -0
- package/src/styles/katex.scss +5 -0
- package/src/types/nodes.ts +7 -1
package/dist/katex.mjs
CHANGED
|
@@ -9491,9 +9491,10 @@ function parseArray(parser, _ref, style) {
|
|
|
9491
9491
|
endRow();
|
|
9492
9492
|
// Arrays terminate newlines with `\crcr` which consumes a `\cr` if
|
|
9493
9493
|
// the last line is empty. However, AMS environments keep the
|
|
9494
|
-
// empty row if it's the only one
|
|
9494
|
+
// empty row if it's the only one, has a manual tag, or is an
|
|
9495
|
+
// automatically numbered row explicitly ended with `\\`.
|
|
9495
9496
|
// NOTE: Currently, `cell` is the last item added into `row`.
|
|
9496
|
-
if (row.length === 1 && cell.type === "styling" && cell.body.length === 1 && cell.body[0].type === "ordgroup" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow) && !Array.isArray(tags == null ? void 0 : tags[tags.length - 1])) {
|
|
9497
|
+
if (row.length === 1 && cell.type === "styling" && cell.body.length === 1 && cell.body[0].type === "ordgroup" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow) && !Array.isArray(tags == null ? void 0 : tags[tags.length - 1]) && !(autoTag && (tags == null ? void 0 : tags[tags.length - 1]) === true)) {
|
|
9497
9498
|
body.pop();
|
|
9498
9499
|
}
|
|
9499
9500
|
if (hLinesBeforeRow.length < body.length + 1) {
|
|
@@ -12207,6 +12208,38 @@ defineFunction({
|
|
|
12207
12208
|
}
|
|
12208
12209
|
});
|
|
12209
12210
|
|
|
12211
|
+
var handler = (_ref, args) => {
|
|
12212
|
+
var parser = _ref.parser;
|
|
12213
|
+
return {
|
|
12214
|
+
type: "reflectbox",
|
|
12215
|
+
mode: parser.mode,
|
|
12216
|
+
body: args[0]
|
|
12217
|
+
};
|
|
12218
|
+
};
|
|
12219
|
+
defineFunction({
|
|
12220
|
+
type: "reflectbox",
|
|
12221
|
+
names: ["\\reflectbox"],
|
|
12222
|
+
numArgs: 1,
|
|
12223
|
+
argTypes: ["hbox"],
|
|
12224
|
+
allowedInText: true,
|
|
12225
|
+
handler,
|
|
12226
|
+
htmlBuilder(group, options) {
|
|
12227
|
+
return makeSpan(["mord", "reflectbox"], [buildGroup$1(group.body, options)], options);
|
|
12228
|
+
},
|
|
12229
|
+
mathmlBuilder(group, options) {
|
|
12230
|
+
return buildGroup(group.body, options);
|
|
12231
|
+
}
|
|
12232
|
+
});
|
|
12233
|
+
// Parse math directly so the shared builders inherit the surrounding style.
|
|
12234
|
+
// \reflectbox instead uses an hbox argument for LaTeX's text-box behavior.
|
|
12235
|
+
defineFunction({
|
|
12236
|
+
type: "reflectbox",
|
|
12237
|
+
names: ["\\mathreflectbox"],
|
|
12238
|
+
numArgs: 1,
|
|
12239
|
+
argTypes: ["math"],
|
|
12240
|
+
handler
|
|
12241
|
+
});
|
|
12242
|
+
|
|
12210
12243
|
defineFunction({
|
|
12211
12244
|
type: "internal",
|
|
12212
12245
|
names: ["\\relax"],
|
|
@@ -14086,6 +14119,8 @@ defineMacro("\u27e6", "\\llbracket"); // blackboard bold [
|
|
|
14086
14119
|
defineMacro("\u27e7", "\\rrbracket"); // blackboard bold ]
|
|
14087
14120
|
defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
|
|
14088
14121
|
defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
|
|
14122
|
+
defineMacro("↤", "\\mapsfrom");
|
|
14123
|
+
defineMacro("\\mapsfrom", "\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}");
|
|
14089
14124
|
defineMacro("\u2983", "\\lBrace"); // blackboard bold {
|
|
14090
14125
|
defineMacro("\u2984", "\\rBrace"); // blackboard bold }
|
|
14091
14126
|
// TODO: Create variable sized versions of the last two items. I believe that
|
|
@@ -16275,7 +16310,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
|
|
|
16275
16310
|
return renderError(error, expression, settings);
|
|
16276
16311
|
}
|
|
16277
16312
|
};
|
|
16278
|
-
var version = "0.18.
|
|
16313
|
+
var version = "0.18.8";
|
|
16279
16314
|
var __domTree = {
|
|
16280
16315
|
Span,
|
|
16281
16316
|
Anchor,
|
package/package.json
CHANGED
|
@@ -210,13 +210,15 @@ function parseArray(
|
|
|
210
210
|
endRow();
|
|
211
211
|
// Arrays terminate newlines with `\crcr` which consumes a `\cr` if
|
|
212
212
|
// the last line is empty. However, AMS environments keep the
|
|
213
|
-
// empty row if it's the only one
|
|
213
|
+
// empty row if it's the only one, has a manual tag, or is an
|
|
214
|
+
// automatically numbered row explicitly ended with `\\`.
|
|
214
215
|
// NOTE: Currently, `cell` is the last item added into `row`.
|
|
215
216
|
if (row.length === 1 && cell.type === "styling" &&
|
|
216
217
|
cell.body.length === 1 && cell.body[0].type === "ordgroup" &&
|
|
217
218
|
cell.body[0].body.length === 0 &&
|
|
218
219
|
(body.length > 1 || !emptySingleRow) &&
|
|
219
|
-
!Array.isArray(tags?.[tags.length - 1])
|
|
220
|
+
!Array.isArray(tags?.[tags.length - 1]) &&
|
|
221
|
+
!(autoTag && tags?.[tags.length - 1] === true)) {
|
|
220
222
|
body.pop();
|
|
221
223
|
}
|
|
222
224
|
if (hLinesBeforeRow.length < body.length + 1) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import defineFunction from "../defineFunction";
|
|
2
|
+
import type {FunctionHandler} from "../defineFunction";
|
|
3
|
+
import {makeSpan} from "../buildCommon";
|
|
4
|
+
|
|
5
|
+
import * as html from "../buildHTML";
|
|
6
|
+
import * as mml from "../buildMathML";
|
|
7
|
+
|
|
8
|
+
const handler: FunctionHandler<"reflectbox"> = ({parser}, args) => ({
|
|
9
|
+
type: "reflectbox",
|
|
10
|
+
mode: parser.mode,
|
|
11
|
+
body: args[0],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
defineFunction({
|
|
15
|
+
type: "reflectbox",
|
|
16
|
+
names: ["\\reflectbox"],
|
|
17
|
+
numArgs: 1,
|
|
18
|
+
argTypes: ["hbox"],
|
|
19
|
+
allowedInText: true,
|
|
20
|
+
|
|
21
|
+
handler,
|
|
22
|
+
|
|
23
|
+
htmlBuilder(group, options) {
|
|
24
|
+
return makeSpan(
|
|
25
|
+
["mord", "reflectbox"],
|
|
26
|
+
[html.buildGroup(group.body, options)],
|
|
27
|
+
options,
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
mathmlBuilder(group, options) {
|
|
31
|
+
return mml.buildGroup(group.body, options);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Parse math directly so the shared builders inherit the surrounding style.
|
|
36
|
+
// \reflectbox instead uses an hbox argument for LaTeX's text-box behavior.
|
|
37
|
+
defineFunction({
|
|
38
|
+
type: "reflectbox",
|
|
39
|
+
names: ["\\mathreflectbox"],
|
|
40
|
+
numArgs: 1,
|
|
41
|
+
argTypes: ["math"],
|
|
42
|
+
handler,
|
|
43
|
+
});
|
package/src/functions.ts
CHANGED
package/src/macros.ts
CHANGED
|
@@ -811,6 +811,12 @@ defineMacro("\\rBrace", "\\html@mathml{" +
|
|
|
811
811
|
"\\mathclose{]\\mkern-3.2mu\\}}}" +
|
|
812
812
|
"{\\mathclose{\\char`\u2984}}");
|
|
813
813
|
|
|
814
|
+
defineMacro("↤", "\\mapsfrom");
|
|
815
|
+
defineMacro(
|
|
816
|
+
"\\mapsfrom",
|
|
817
|
+
"\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}",
|
|
818
|
+
);
|
|
819
|
+
|
|
814
820
|
defineMacro("\u2983", "\\lBrace"); // blackboard bold {
|
|
815
821
|
defineMacro("\u2984", "\\rBrace"); // blackboard bold }
|
|
816
822
|
|
package/src/styles/katex.scss
CHANGED
|
@@ -602,6 +602,11 @@ $display-margin: 1em 0 !default;
|
|
|
602
602
|
padding: 0 0.03889em; // pad 1mu left and right (in scriptstyle)
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
+
.reflectbox {
|
|
606
|
+
display: inline-block;
|
|
607
|
+
transform: scaleX(-1);
|
|
608
|
+
}
|
|
609
|
+
|
|
605
610
|
.eqn-num::before {
|
|
606
611
|
counter-increment: katexEqnNo;
|
|
607
612
|
content: "(" counter(katexEqnNo) ")";
|
package/src/types/nodes.ts
CHANGED
|
@@ -69,7 +69,8 @@ export type AnyParseNode =
|
|
|
69
69
|
| SmashNode
|
|
70
70
|
| SqrtNode
|
|
71
71
|
| VerticalCenterNode
|
|
72
|
-
| ExtensibleArrowNode
|
|
72
|
+
| ExtensibleArrowNode
|
|
73
|
+
| ReflectBoxNode;
|
|
73
74
|
|
|
74
75
|
// ParseNode's corresponding to Symbol `Group`s in symbols.js.
|
|
75
76
|
export type SymbolParseNode =
|
|
@@ -454,3 +455,8 @@ type ExtensibleArrowNode = BaseNode & {
|
|
|
454
455
|
body: AnyParseNode;
|
|
455
456
|
below: AnyParseNode | null;
|
|
456
457
|
}
|
|
458
|
+
|
|
459
|
+
type ReflectBoxNode = BaseNode & {
|
|
460
|
+
type: "reflectbox";
|
|
461
|
+
body: AnyParseNode;
|
|
462
|
+
};
|