katex 0.10.0-rc → 0.10.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/CHANGELOG.md +214 -126
- package/README.md +18 -17
- package/cli.js +5 -1
- package/contrib/auto-render/README.md +1 -1
- package/contrib/auto-render/auto-render.js +4 -1
- package/contrib/auto-render/test/auto-render-spec.js +17 -0
- package/contrib/copy-tex/README.md +8 -2
- package/contrib/copy-tex/copy-tex.js +0 -1
- package/contrib/copy-tex/copy-tex.webpack.js +6 -0
- package/contrib/mathtex-script-type/README.md +10 -6
- package/contrib/mhchem/README.md +19 -0
- package/contrib/mhchem/mhchem.js +1695 -0
- package/contrib/mhchem/mhchem.patch +235 -0
- package/dist/README.md +18 -17
- package/dist/contrib/auto-render.js +179 -161
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +215 -0
- package/dist/contrib/copy-tex.js +84 -62
- package/dist/contrib/copy-tex.min.css +1 -1
- package/dist/contrib/copy-tex.min.js +1 -1
- package/dist/contrib/copy-tex.mjs +85 -0
- package/dist/contrib/mathtex-script-type.js +17 -14
- package/dist/contrib/mathtex-script-type.mjs +24 -0
- package/dist/contrib/mhchem.js +3241 -0
- package/dist/contrib/mhchem.min.js +1 -0
- package/dist/contrib/mhchem.mjs +3109 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +24 -9
- package/dist/katex.js +13295 -12413
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +13388 -11826
- package/katex.js +1 -2
- package/package.json +60 -48
- package/src/Lexer.js +25 -25
- package/src/MacroExpander.js +0 -1
- package/src/Options.js +11 -75
- package/src/Parser.js +231 -313
- package/src/Settings.js +6 -0
- package/src/buildCommon.js +140 -103
- package/src/buildHTML.js +125 -121
- package/src/buildMathML.js +14 -4
- package/src/buildTree.js +16 -10
- package/src/delimiter.js +4 -3
- package/src/domTree.js +91 -44
- package/src/environments/array.js +120 -7
- package/src/fontMetrics.js +3 -2
- package/src/functions/arrow.js +21 -7
- package/src/functions/color.js +2 -37
- package/src/functions/delimsizing.js +18 -11
- package/src/functions/enclose.js +19 -4
- package/src/functions/environment.js +35 -4
- package/src/functions/font.js +1 -2
- package/src/functions/genfrac.js +35 -20
- package/src/functions/href.js +5 -3
- package/src/functions/includegraphics.js +146 -0
- package/src/functions/mclass.js +1 -0
- package/src/functions/op.js +21 -32
- package/src/functions/operatorname.js +1 -2
- package/src/functions/ordgroup.js +4 -0
- package/src/functions/phantom.js +7 -3
- package/src/functions/rule.js +20 -9
- package/src/functions/sizing.js +2 -4
- package/src/functions/smash.js +5 -2
- package/src/functions/sqrt.js +1 -4
- package/src/functions/styling.js +0 -1
- package/src/functions/supsub.js +6 -2
- package/src/functions/symbolsOp.js +4 -0
- package/src/functions/symbolsSpacing.js +29 -6
- package/src/functions/tag.js +20 -4
- package/src/functions/text.js +6 -4
- package/src/functions/verb.js +16 -4
- package/src/functions.js +2 -0
- package/src/katex.less +35 -12
- package/src/macros.js +161 -36
- package/src/mathMLTree.js +17 -19
- package/src/parseNode.js +27 -1
- package/src/stretchy.js +3 -1
- package/src/svgGeometry.js +1 -1
- package/src/symbols.js +39 -17
- package/src/tree.js +0 -4
- package/src/types.js +4 -3
- package/src/unicodeMake.js +1 -1
- package/src/utils.js +1 -62
- package/src/wide-character.js +2 -2
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
0a1
|
|
2
|
+
> /* eslint-disable */
|
|
3
|
+
5a7,22
|
|
4
|
+
> * KaTeX mhchem.js
|
|
5
|
+
> *
|
|
6
|
+
> * This file implements a KaTeX version of mhchem version 3.3.0.
|
|
7
|
+
> * It is adapted from MathJax/extensions/TeX/mhchem.js
|
|
8
|
+
> * It differs from the MathJax version as follows:
|
|
9
|
+
> * 1. The interface is changed so that it can be called from KaTeX, not MathJax.
|
|
10
|
+
> * 2. \rlap and \llap are replaced with \mathrlap and \mathllap.
|
|
11
|
+
> * 3. Four lines of code are edited in order to use \raisebox instead of \raise.
|
|
12
|
+
> * 4. The reaction arrow code is simplified. All reaction arrows are rendered
|
|
13
|
+
> * using KaTeX extensible arrows instead of building non-extensible arrows.
|
|
14
|
+
> * 5. \tripledash vertical alignment is slightly adjusted.
|
|
15
|
+
> *
|
|
16
|
+
> * This code, as other KaTeX code, is released under the MIT license.
|
|
17
|
+
> *
|
|
18
|
+
> * /*************************************************************
|
|
19
|
+
> *
|
|
20
|
+
33a51
|
|
21
|
+
> // version: "3.3.0" for MathJax and KaTeX
|
|
22
|
+
35,37d52
|
|
23
|
+
< MathJax.Extension["TeX/mhchem"] = {
|
|
24
|
+
< version: "3.3.0"
|
|
25
|
+
< };
|
|
26
|
+
39c54
|
|
27
|
+
< MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () {
|
|
28
|
+
---
|
|
29
|
+
> // Add \ce, \pu, and \tripledash to the KaTeX macros.
|
|
30
|
+
41c56,58
|
|
31
|
+
< var TEX = MathJax.InputJax.TeX;
|
|
32
|
+
---
|
|
33
|
+
> katex.__defineMacro("\\ce", function(context) {
|
|
34
|
+
> return chemParse(context.consumeArgs(1)[0], "ce")
|
|
35
|
+
> });
|
|
36
|
+
43,47c60,62
|
|
37
|
+
< //
|
|
38
|
+
< // This is the main class for handing the \ce and related commands.
|
|
39
|
+
< // Its main method is Parse() which takes the argument to \ce and
|
|
40
|
+
< // returns the corresponding TeX string.
|
|
41
|
+
< //
|
|
42
|
+
---
|
|
43
|
+
> katex.__defineMacro("\\pu", function(context) {
|
|
44
|
+
> return chemParse(context.consumeArgs(1)[0], "pu");
|
|
45
|
+
> });
|
|
46
|
+
49,50c64,68
|
|
47
|
+
< var CE = MathJax.Object.Subclass({
|
|
48
|
+
< string: "", // the \ce string being parsed
|
|
49
|
+
---
|
|
50
|
+
> // Needed for \bond for the ~ forms
|
|
51
|
+
> // Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not
|
|
52
|
+
> // a mathematical minus, U+2212. So we need that extra 0.56.
|
|
53
|
+
> katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu"
|
|
54
|
+
> + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
|
|
55
|
+
52,55c70
|
|
56
|
+
< //
|
|
57
|
+
< // Store the string when a CE object is created
|
|
58
|
+
< //
|
|
59
|
+
< Init: function (string) { this.string = string; },
|
|
60
|
+
---
|
|
61
|
+
> import katex from "katex";
|
|
62
|
+
57,64c72,85
|
|
63
|
+
< //
|
|
64
|
+
< // This converts the CE string to a TeX string.
|
|
65
|
+
< //
|
|
66
|
+
< Parse: function (stateMachine) {
|
|
67
|
+
< try {
|
|
68
|
+
< return texify.go(mhchemParser.go(this.string, stateMachine));
|
|
69
|
+
< } catch (ex) {
|
|
70
|
+
< TEX.Error(ex);
|
|
71
|
+
---
|
|
72
|
+
> //
|
|
73
|
+
> // This is the main function for handing the \ce and \pu commands.
|
|
74
|
+
> // It takes the argument to \ce or \pu and returns the corresponding TeX string.
|
|
75
|
+
> //
|
|
76
|
+
>
|
|
77
|
+
> var chemParse = function (tokens, stateMachine) {
|
|
78
|
+
> // Recreate the argument string from KaTeX's array of tokens.
|
|
79
|
+
> var str = "";
|
|
80
|
+
> var expectedLoc = tokens[tokens.length - 1].loc.start
|
|
81
|
+
> for (var i = tokens.length - 1; i >= 0; i--) {
|
|
82
|
+
> if(tokens[i].loc.start > expectedLoc) {
|
|
83
|
+
> // context.consumeArgs has eaten a space.
|
|
84
|
+
> str += " ";
|
|
85
|
+
> expectedLoc = tokens[i].loc.start;
|
|
86
|
+
65a87,88
|
|
87
|
+
> str += tokens[i].text;
|
|
88
|
+
> expectedLoc += tokens[i].text.length;
|
|
89
|
+
67c90,92
|
|
90
|
+
< });
|
|
91
|
+
---
|
|
92
|
+
> var tex = texify.go(mhchemParser.go(str, stateMachine));
|
|
93
|
+
> return tex;
|
|
94
|
+
> };
|
|
95
|
+
1405,1406c1430,1431
|
|
96
|
+
< res += "^{\\smash[t]{\\vphantom{2}}\\llap{"+(b5.b||"")+"}}";
|
|
97
|
+
< res += "_{\\vphantom{2}\\llap{\\smash[t]{"+(b5.p||"")+"}}}";
|
|
98
|
+
---
|
|
99
|
+
> res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{"+(b5.b||"")+"}}";
|
|
100
|
+
> res += "_{\\vphantom{2}\\mathllap{\\smash[t]{"+(b5.p||"")+"}}}";
|
|
101
|
+
1508,1520c1533,1536
|
|
102
|
+
< var arrow = texify._getArrow(buf.r);
|
|
103
|
+
< if (b6.rd || b6.rq) {
|
|
104
|
+
< if (buf.r === "<=>" || buf.r === "<=>>" || buf.r === "<<=>" || buf.r === "<-->") {
|
|
105
|
+
< // arrows that cannot stretch correctly yet, https://github.com/mathjax/MathJax/issues/1491
|
|
106
|
+
< arrow = "\\long"+arrow;
|
|
107
|
+
< if (b6.rd) { arrow = "\\overset{"+b6.rd+"}{"+arrow+"}"; }
|
|
108
|
+
< if (b6.rq) { arrow = "\\underset{\\lower7mu{"+b6.rq+"}}{"+arrow+"}"; }
|
|
109
|
+
< arrow = " {}\\mathrel{"+arrow+"}{} ";
|
|
110
|
+
< } else {
|
|
111
|
+
< if (b6.rq) { arrow += "[{"+b6.rq+"}]"; }
|
|
112
|
+
< arrow += "{"+b6.rd+"}";
|
|
113
|
+
< arrow = " {}\\mathrel{\\x"+arrow+"}{} ";
|
|
114
|
+
< }
|
|
115
|
+
---
|
|
116
|
+
> var arrow = "\\x" + texify._getArrow(buf.r);
|
|
117
|
+
> if (b6.rq) { arrow += "[{" + b6.rq + "}]"; }
|
|
118
|
+
> if (b6.rd) {
|
|
119
|
+
> arrow += "{" + b6.rd + "}";
|
|
120
|
+
1522c1538
|
|
121
|
+
< arrow = " {}\\mathrel{\\long"+arrow+"}{} ";
|
|
122
|
+
---
|
|
123
|
+
> arrow += "{}";
|
|
124
|
+
1615c1631
|
|
125
|
+
< case "<-->": return "leftrightarrows";
|
|
126
|
+
---
|
|
127
|
+
> case "<-->": return "rightleftarrows";
|
|
128
|
+
1618,1619c1634,1635
|
|
129
|
+
< case "<=>>": return "Rightleftharpoons";
|
|
130
|
+
< case "<<=>": return "Leftrightharpoons";
|
|
131
|
+
---
|
|
132
|
+
> case "<=>>": return "rightequilibrium";
|
|
133
|
+
> case "<<=>": return "leftequilibrium";
|
|
134
|
+
1634,1637c1650,1653
|
|
135
|
+
< case "~-": return "{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";
|
|
136
|
+
< case "~=": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";
|
|
137
|
+
< case "~--": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";
|
|
138
|
+
< case "-~-": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";
|
|
139
|
+
---
|
|
140
|
+
> case "~-": return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
|
|
141
|
+
> case "~=": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
142
|
+
> case "~--": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
143
|
+
> case "-~-": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
|
|
144
|
+
1680,1770d1695
|
|
145
|
+
<
|
|
146
|
+
< //
|
|
147
|
+
< // MathJax definitions
|
|
148
|
+
< //
|
|
149
|
+
< MathJax.Extension["TeX/mhchem"].CE = CE;
|
|
150
|
+
<
|
|
151
|
+
< /***************************************************************************/
|
|
152
|
+
<
|
|
153
|
+
< TEX.Definitions.Add({
|
|
154
|
+
< macros: {
|
|
155
|
+
< //
|
|
156
|
+
< // Set up the macros for chemistry
|
|
157
|
+
< //
|
|
158
|
+
< ce: "CE",
|
|
159
|
+
< pu: "PU",
|
|
160
|
+
<
|
|
161
|
+
< //
|
|
162
|
+
< // Make these load AMSmath package (redefined below when loaded)
|
|
163
|
+
< //
|
|
164
|
+
< xleftrightarrow: ["Extension", "AMSmath"],
|
|
165
|
+
< xrightleftharpoons: ["Extension", "AMSmath"],
|
|
166
|
+
< xRightleftharpoons: ["Extension", "AMSmath"],
|
|
167
|
+
< xLeftrightharpoons: ["Extension", "AMSmath"],
|
|
168
|
+
<
|
|
169
|
+
< // FIXME: These don't work well in FF NativeMML mode
|
|
170
|
+
< longrightleftharpoons: ["Macro", "\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],
|
|
171
|
+
< longRightleftharpoons: ["Macro", "\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"],
|
|
172
|
+
< longLeftrightharpoons: ["Macro", "\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],
|
|
173
|
+
< longleftrightarrows: ["Macro", "\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}"],
|
|
174
|
+
<
|
|
175
|
+
< //
|
|
176
|
+
< // Needed for \bond for the ~ forms
|
|
177
|
+
< // Not perfectly aligned when zoomed in, but on 100%
|
|
178
|
+
< //
|
|
179
|
+
< tripledash: ["Macro", "\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"]
|
|
180
|
+
< },
|
|
181
|
+
< }, null, true);
|
|
182
|
+
<
|
|
183
|
+
< if (!MathJax.Extension["TeX/AMSmath"]) {
|
|
184
|
+
< TEX.Definitions.Add({
|
|
185
|
+
< macros: {
|
|
186
|
+
< xrightarrow: ["Extension", "AMSmath"],
|
|
187
|
+
< xleftarrow: ["Extension", "AMSmath"]
|
|
188
|
+
< }
|
|
189
|
+
< }, null, true);
|
|
190
|
+
< }
|
|
191
|
+
<
|
|
192
|
+
< //
|
|
193
|
+
< // These arrows need to wait until AMSmath is loaded
|
|
194
|
+
< //
|
|
195
|
+
< MathJax.Hub.Register.StartupHook("TeX AMSmath Ready", function () {
|
|
196
|
+
< TEX.Definitions.Add({
|
|
197
|
+
< macros: {
|
|
198
|
+
< //
|
|
199
|
+
< // Some of these are hacks for now
|
|
200
|
+
< //
|
|
201
|
+
< xleftrightarrow: ["xArrow", 0x2194, 6, 6],
|
|
202
|
+
< xrightleftharpoons: ["xArrow", 0x21CC, 5, 7], // FIXME: doesn't stretch in HTML-CSS output
|
|
203
|
+
< xRightleftharpoons: ["xArrow", 0x21CC, 5, 7], // FIXME: how should this be handled?
|
|
204
|
+
< xLeftrightharpoons: ["xArrow", 0x21CC, 5, 7]
|
|
205
|
+
< }
|
|
206
|
+
< }, null, true);
|
|
207
|
+
< });
|
|
208
|
+
<
|
|
209
|
+
< TEX.Parse.Augment({
|
|
210
|
+
<
|
|
211
|
+
< //
|
|
212
|
+
< // Implements \ce and friends
|
|
213
|
+
< //
|
|
214
|
+
< CE: function (name) {
|
|
215
|
+
< var arg = this.GetArgument(name);
|
|
216
|
+
< var tex = CE(arg).Parse();
|
|
217
|
+
< this.string = tex + this.string.substr(this.i); this.i = 0;
|
|
218
|
+
< },
|
|
219
|
+
<
|
|
220
|
+
< PU: function (name) {
|
|
221
|
+
< var arg = this.GetArgument(name);
|
|
222
|
+
< var tex = CE(arg).Parse('pu');
|
|
223
|
+
< this.string = tex + this.string.substr(this.i); this.i = 0;
|
|
224
|
+
< }
|
|
225
|
+
<
|
|
226
|
+
< });
|
|
227
|
+
<
|
|
228
|
+
< //
|
|
229
|
+
< // Indicate that the extension is ready
|
|
230
|
+
< //
|
|
231
|
+
< MathJax.Hub.Startup.signal.Post("TeX mhchem Ready");
|
|
232
|
+
<
|
|
233
|
+
< });
|
|
234
|
+
<
|
|
235
|
+
< MathJax.Ajax.loadComplete("[mhchem]/unpacked/mhchem.js");
|
package/dist/README.md
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
# [<img src="https://
|
|
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
|
-
[](https://circleci.com/gh/KaTeX/KaTeX)
|
|
4
|
+
[](https://codecov.io/gh/KaTeX/KaTeX)
|
|
5
|
+
[](https://gitter.im/KaTeX/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
6
|
+
[](https://greenkeeper.io/)
|
|
6
7
|
[](https://www.jsdelivr.com/package/npm/katex)
|
|
7
|
-

|
|
8
9
|
|
|
9
10
|
KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
|
|
10
11
|
|
|
11
12
|
* **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://www.intmath.com/cg5/katex-mathjax-comparison.php).
|
|
12
|
-
* **Print quality:** KaTeX
|
|
13
|
+
* **Print quality:** KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
|
|
13
14
|
* **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
|
|
14
15
|
* **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
|
|
15
16
|
|
|
16
17
|
KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 9–11.
|
|
17
18
|
|
|
18
|
-
KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://
|
|
19
|
+
KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html).
|
|
19
20
|
|
|
20
|
-
Try out KaTeX [on the demo page](https://
|
|
21
|
+
Try out KaTeX [on the demo page](https://katex.org/#demo)!
|
|
21
22
|
|
|
22
23
|
## Getting started
|
|
23
24
|
|
|
@@ -28,22 +29,22 @@ Try out KaTeX [on the demo page](https://khan.github.io/KaTeX/#demo)!
|
|
|
28
29
|
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
|
|
29
30
|
<html>
|
|
30
31
|
<head>
|
|
31
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.
|
|
32
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
|
|
32
33
|
|
|
33
34
|
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
|
34
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.
|
|
35
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script>
|
|
35
36
|
|
|
36
37
|
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
|
37
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.
|
|
38
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
|
|
38
39
|
onload="renderMathInElement(document.body);"></script>
|
|
39
40
|
</head>
|
|
40
41
|
...
|
|
41
42
|
</html>
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
You can also [download KaTeX](https://github.com/
|
|
45
|
+
You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself.
|
|
45
46
|
|
|
46
|
-
For details on how to configure auto-render extension, refer to [the documentation](https://
|
|
47
|
+
For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html).
|
|
47
48
|
|
|
48
49
|
### API
|
|
49
50
|
|
|
@@ -73,13 +74,13 @@ JavaScript on the client.
|
|
|
73
74
|
The examples above use the `throwOnError: false` option, which renders invalid
|
|
74
75
|
inputs as the TeX source code in red (by default), with the error message as
|
|
75
76
|
hover text. For other available options, see the
|
|
76
|
-
[API documentation](https://
|
|
77
|
-
[options documentation](https://
|
|
78
|
-
[handling errors documentation](https://
|
|
77
|
+
[API documentation](https://katex.org/docs/api.html),
|
|
78
|
+
[options documentation](https://katex.org/docs/options.html), and
|
|
79
|
+
[handling errors documentation](https://katex.org/docs/error.html).
|
|
79
80
|
|
|
80
81
|
## Demo and Documentation
|
|
81
82
|
|
|
82
|
-
Learn more about using KaTeX [on the website](https://
|
|
83
|
+
Learn more about using KaTeX [on the website](https://katex.org)!
|
|
83
84
|
|
|
84
85
|
## Contributing
|
|
85
86
|
|