katex 0.13.22 → 0.14.1
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 +5 -5
- package/cli.js +17 -46
- package/contrib/copy-tex/README.md +3 -3
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +5 -5
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/katex.css +1 -1
- package/dist/katex.js +1769 -1614
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +2222 -2093
- package/katex.js +5 -1
- package/package.json +34 -1
- package/src/Settings.js +183 -32
- package/src/buildCommon.js +12 -12
- package/src/buildHTML.js +5 -4
- package/src/delimiter.js +11 -10
- package/src/domTree.js +2 -1
- package/src/environments/array.js +9 -9
- package/src/environments/cd.js +2 -1
- package/src/fontMetricsData.js +2 -1
- package/src/fonts/makeFF +2 -0
- package/src/functions/accent.js +4 -3
- package/src/functions/cr.js +3 -3
- package/src/functions/delimsizing.js +4 -2
- package/src/functions/enclose.js +7 -7
- package/src/functions/genfrac.js +2 -2
- package/src/functions/includegraphics.js +7 -9
- package/src/functions/lap.js +3 -2
- package/src/functions/op.js +2 -1
- package/src/functions/rule.js +10 -10
- package/src/functions/sizing.js +2 -1
- package/src/functions/sqrt.js +2 -1
- package/src/functions/supsub.js +3 -2
- package/src/functions/utils/assembleSupSub.js +6 -5
- package/src/macros.js +3 -2
- package/src/mathMLTree.js +3 -2
- package/src/metrics/extract_ttfs.py +3 -0
- package/src/stretchy.js +8 -7
- package/src/units.js +8 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
|
|
2
2
|
[](https://www.npmjs.com/package/katex)
|
|
3
3
|
[](https://github.com/semantic-release/semantic-release)
|
|
4
|
-
[](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
|
|
5
|
+
[](https://codecov.io/gh/KaTeX/KaTeX)
|
|
6
6
|
[](https://github.com/KaTeX/KaTeX/discussions)
|
|
7
7
|
[](https://www.jsdelivr.com/package/npm/katex)
|
|
8
8
|

|
|
@@ -31,13 +31,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
|
|
|
31
31
|
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
|
|
32
32
|
<html>
|
|
33
33
|
<head>
|
|
34
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.
|
|
34
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/katex.min.css" integrity="sha384-2zx8BdwKFuNSCN7GLgJQsaHE2O069/0DdWh3ijV8LXacwoIjXgZXc6GDcyPdiUTy" crossorigin="anonymous">
|
|
35
35
|
|
|
36
36
|
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
|
37
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
37
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/katex.min.js" integrity="sha384-G4iZzF9Q1vvkqA9laXwSt2Ny6DcbB5aeNHFpuGFdmXKHLaQw73gnLC5VFSavZoof" crossorigin="anonymous"></script>
|
|
38
38
|
|
|
39
39
|
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
|
40
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
40
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
|
|
41
41
|
onload="renderMathInElement(document.body);"></script>
|
|
42
42
|
</head>
|
|
43
43
|
...
|
package/cli.js
CHANGED
|
@@ -20,51 +20,18 @@ try {
|
|
|
20
20
|
const {version} = require("./package.json");
|
|
21
21
|
const fs = require("fs");
|
|
22
22
|
|
|
23
|
-
const program = require("commander")
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"Render errors (in the color given by --error-color) instead of " +
|
|
35
|
-
"throwing a ParseError exception when encountering an error.")
|
|
36
|
-
.option("-c, --error-color <color>",
|
|
37
|
-
"A color string given in the format 'rgb' or 'rrggbb' (no #). " +
|
|
38
|
-
"This option determines the color of errors rendered by the -t option.",
|
|
39
|
-
"#cc0000",
|
|
40
|
-
(color) => "#" + color)
|
|
41
|
-
.option("-b, --color-is-text-color",
|
|
42
|
-
"Makes \\color behave like LaTeX's 2-argument \\textcolor, " +
|
|
43
|
-
"instead of LaTeX's one-argument \\color mode change.")
|
|
44
|
-
.option("-S, --strict",
|
|
45
|
-
"Turn on strict / LaTeX faithfulness mode, which throws an error " +
|
|
46
|
-
"if the input uses features that are not supported by LaTeX.")
|
|
47
|
-
.option("-s, --max-size <n>",
|
|
48
|
-
"If non-zero, all user-specified sizes, e.g. in " +
|
|
49
|
-
"\\rule{500em}{500em}, will be capped to maxSize ems. " +
|
|
50
|
-
"Otherwise, elements and spaces can be arbitrarily large",
|
|
51
|
-
Infinity, parseInt)
|
|
52
|
-
.option("-e, --max-expand <n>",
|
|
53
|
-
"Limit the number of macro expansions to the specified number, to " +
|
|
54
|
-
"prevent e.g. infinite macro loops. If set to Infinity, the macro " +
|
|
55
|
-
"expander will try to fully expand as in LaTeX.",
|
|
56
|
-
(n) => (n === "Infinity" ? Infinity : parseInt(n)))
|
|
57
|
-
.option("-m, --macro <def>",
|
|
58
|
-
"Define custom macro of the form '\\foo:expansion' (use multiple -m " +
|
|
59
|
-
"arguments for multiple macros).",
|
|
60
|
-
(def, defs) => {
|
|
61
|
-
defs.push(def);
|
|
62
|
-
return defs;
|
|
63
|
-
}, [])
|
|
64
|
-
.option("-f, --macro-file <path>",
|
|
23
|
+
const program = require("commander").version(version);
|
|
24
|
+
for (const prop in katex.SETTINGS_SCHEMA) {
|
|
25
|
+
if (katex.SETTINGS_SCHEMA.hasOwnProperty(prop)) {
|
|
26
|
+
const opt = katex.SETTINGS_SCHEMA[prop];
|
|
27
|
+
if (opt.cli !== false) {
|
|
28
|
+
program.option(opt.cli || "--" + prop, opt.cliDescription ||
|
|
29
|
+
opt.description, opt.cliProcessor, opt.cliDefault);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
program.option("-f, --macro-file <path>",
|
|
65
34
|
"Read macro definitions, one per line, from the given file.")
|
|
66
|
-
.option("-T, --trust",
|
|
67
|
-
"Trust the input, enabling all HTML features such as \\url.")
|
|
68
35
|
.option("-i, --input <path>", "Read LaTeX input from the given file.")
|
|
69
36
|
.option("-o, --output <path>", "Write html output to the given file.");
|
|
70
37
|
|
|
@@ -125,10 +92,14 @@ function readInput() {
|
|
|
125
92
|
}
|
|
126
93
|
|
|
127
94
|
function writeOutput(input) {
|
|
95
|
+
// --format specifies the KaTeX output
|
|
96
|
+
const outputFile = options.output;
|
|
97
|
+
options.output = options.format;
|
|
98
|
+
|
|
128
99
|
const output = katex.renderToString(input, options) + "\n";
|
|
129
100
|
|
|
130
|
-
if (
|
|
131
|
-
fs.writeFile(
|
|
101
|
+
if (outputFile) {
|
|
102
|
+
fs.writeFile(outputFile, output, function(err) {
|
|
132
103
|
if (err) {
|
|
133
104
|
return console.log(err);
|
|
134
105
|
}
|
|
@@ -21,8 +21,8 @@ provided by this extension). Without this CSS, partially selected equations
|
|
|
21
21
|
will just get the usual HTML copy/paste behavior.
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
|
-
<link href="https://cdn.jsdelivr.net/npm/katex@0.
|
|
25
|
-
<script src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
24
|
+
<link href="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
See [index.html](index.html) for an example.
|
|
@@ -37,7 +37,7 @@ statement with `require('katex/contrib/copy-tex/katex2tex.js')`.
|
|
|
37
37
|
|
|
38
38
|
ECMAScript module is also available:
|
|
39
39
|
```html
|
|
40
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
40
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
### Known Issues
|
|
@@ -11,7 +11,7 @@ included in the page, in addition to KaTeX.
|
|
|
11
11
|
Load the extension by adding the following line to your HTML file.
|
|
12
12
|
|
|
13
13
|
```html
|
|
14
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
14
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
|
|
15
15
|
```
|
|
16
16
|
You can download the script and use it locally, or from a local KaTeX installation instead.
|
|
17
17
|
|
|
@@ -23,9 +23,9 @@ Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1
|
|
|
23
23
|
<!DOCTYPE html>
|
|
24
24
|
<html>
|
|
25
25
|
<head>
|
|
26
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.
|
|
27
|
-
<script src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
28
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
26
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/katex.min.css" integrity="sha384-2zx8BdwKFuNSCN7GLgJQsaHE2O069/0DdWh3ijV8LXacwoIjXgZXc6GDcyPdiUTy" crossorigin="anonymous">
|
|
27
|
+
<script src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/katex.min.js" integrity="sha384-G4iZzF9Q1vvkqA9laXwSt2Ny6DcbB5aeNHFpuGFdmXKHLaQw73gnLC5VFSavZoof" crossorigin="anonymous"></script>
|
|
28
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
31
|
<script type="math/tex">x+\sqrt{1-x^2}</script>
|
|
@@ -35,4 +35,4 @@ Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1
|
|
|
35
35
|
|
|
36
36
|
ECMAScript module is also available:
|
|
37
37
|
```html
|
|
38
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
38
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script>
|
package/contrib/mhchem/README.md
CHANGED
|
@@ -7,7 +7,7 @@ This extension adds to KaTeX the `\ce` and `\pu` functions from the [mhchem](htt
|
|
|
7
7
|
This extension isn't part of core KaTeX, so the script should be separately included. Write the following line into the HTML page's `<head>`. Place it *after* the line that calls `katex.js`, and if you make use of the [auto-render](https://katex.org/docs/autorender.html) extension, place it *before* the line that calls `auto-render.js`.
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
10
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" crossorigin="anonymous"></script>
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
If you remove the `defer` attribute from this tag, then you must also remove the `defer` attribute from the `<script src="https://../katex.min.js">` tag.
|
package/dist/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
|
|
2
2
|
[](https://www.npmjs.com/package/katex)
|
|
3
3
|
[](https://github.com/semantic-release/semantic-release)
|
|
4
|
-
[](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
|
|
5
|
+
[](https://codecov.io/gh/KaTeX/KaTeX)
|
|
6
6
|
[](https://github.com/KaTeX/KaTeX/discussions)
|
|
7
7
|
[](https://www.jsdelivr.com/package/npm/katex)
|
|
8
8
|

|
|
@@ -31,13 +31,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
|
|
|
31
31
|
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
|
|
32
32
|
<html>
|
|
33
33
|
<head>
|
|
34
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.
|
|
34
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/katex.min.css" integrity="sha384-2zx8BdwKFuNSCN7GLgJQsaHE2O069/0DdWh3ijV8LXacwoIjXgZXc6GDcyPdiUTy" crossorigin="anonymous">
|
|
35
35
|
|
|
36
36
|
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
|
37
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
37
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/katex.min.js" integrity="sha384-G4iZzF9Q1vvkqA9laXwSt2Ny6DcbB5aeNHFpuGFdmXKHLaQw73gnLC5VFSavZoof" crossorigin="anonymous"></script>
|
|
38
38
|
|
|
39
39
|
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
|
40
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
40
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.14.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
|
|
41
41
|
onload="renderMathInElement(document.body);"></script>
|
|
42
42
|
</head>
|
|
43
43
|
...
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|