katex 0.10.1 → 0.12.0
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 +141 -0
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/cli.js +0 -0
- package/contrib/auto-render/auto-render.js +12 -3
- package/contrib/copy-tex/README.md +3 -5
- package/contrib/mathtex-script-type/README.md +12 -14
- package/contrib/mhchem/README.md +3 -1
- package/contrib/render-a11y-string/render-a11y-string.js +712 -0
- package/contrib/render-a11y-string/test/render-a11y-string-spec.js +526 -0
- package/dist/README.md +6 -6
- package/dist/contrib/auto-render.js +14 -3
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +14 -3
- package/dist/contrib/mhchem.min.js +1 -1
- package/dist/contrib/render-a11y-string.js +870 -0
- package/dist/contrib/render-a11y-string.min.js +1 -0
- package/dist/contrib/render-a11y-string.mjs +753 -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 +34 -10
- package/dist/katex.js +2906 -2115
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +2809 -2020
- package/package.json +12 -11
- package/src/Lexer.js +1 -0
- package/src/MacroExpander.js +39 -10
- package/src/Options.js +15 -75
- package/src/Parser.js +152 -115
- package/src/Settings.js +70 -7
- package/src/Token.js +2 -0
- package/src/buildCommon.js +24 -90
- package/src/buildHTML.js +31 -31
- package/src/buildMathML.js +52 -9
- package/src/buildTree.js +13 -6
- package/src/defineFunction.js +7 -22
- package/src/delimiter.js +66 -27
- package/src/domTree.js +71 -4
- package/src/environments/array.js +235 -25
- package/src/fontMetrics.js +11 -2
- package/src/functions/accent.js +9 -9
- package/src/functions/accentunder.js +2 -2
- package/src/functions/arrow.js +15 -5
- package/src/functions/color.js +9 -38
- package/src/functions/def.js +184 -0
- package/src/functions/delimsizing.js +32 -8
- package/src/functions/enclose.js +33 -6
- package/src/functions/font.js +4 -1
- package/src/functions/genfrac.js +39 -27
- package/src/functions/horizBrace.js +6 -7
- package/src/functions/href.js +16 -0
- package/src/functions/html.js +102 -0
- package/src/functions/includegraphics.js +153 -0
- package/src/functions/lap.js +4 -7
- package/src/functions/math.js +1 -5
- package/src/functions/mclass.js +41 -2
- package/src/functions/op.js +27 -111
- package/src/functions/operatorname.js +136 -92
- package/src/functions/ordgroup.js +1 -1
- package/src/functions/overline.js +3 -2
- package/src/functions/phantom.js +5 -2
- package/src/functions/raisebox.js +4 -16
- package/src/functions/rule.js +20 -9
- package/src/functions/styling.js +0 -9
- package/src/functions/supsub.js +27 -7
- package/src/functions/symbolsOp.js +4 -0
- package/src/functions/tag.js +20 -4
- package/src/functions/text.js +4 -3
- package/src/functions/underline.js +3 -2
- package/src/functions/utils/assembleSupSub.js +110 -0
- package/src/functions.js +3 -0
- package/src/katex.less +45 -9
- package/src/macros.js +259 -98
- package/src/mathMLTree.js +6 -4
- package/src/parseNode.js +37 -57
- package/src/stretchy.js +3 -1
- package/src/svgGeometry.js +136 -44
- package/src/symbols.js +52 -69
- package/src/tree.js +2 -2
- package/src/types.js +2 -1
- package/src/unicodeAccents.js +3 -1
- package/src/unicodeSymbols.js +30 -321
- package/src/utils.js +10 -0
- package/src/wide-character.js +2 -2
- package/src/unicodeMake.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,147 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file. This CHANGELOG roughly follows the guidelines from [www.keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
3
3
|
|
|
4
|
+
## [v0.12.0]
|
|
5
|
+
### Added
|
|
6
|
+
- `globalGroup` option to place definitions in global scope (#2091)
|
|
7
|
+
- `\cal` (#2116)
|
|
8
|
+
- `{rcases}` and `{drcases}` (#2149)
|
|
9
|
+
- HTML extension (#2082)
|
|
10
|
+
- HTML extension can be enabled using `strict` and `trust` setting. See https://katex.org/docs/options.html for more details. **Please review its security implication before enabling the extension.**
|
|
11
|
+
- `\message`, `\errmessage`, and `\show` for debugging (#2135)
|
|
12
|
+
- bra-ket notation (#2162)
|
|
13
|
+
- `\expandafter`, `\noexpand`, `\edef`, `\let`, and `\long` (#2122)
|
|
14
|
+
- Support MathML display mode (#2220)
|
|
15
|
+
- `\minuso` (#2213)
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Update documentation (#2086, #2108, #2107, #2106, #2143, #2178, #2195, #2231, #2239, #2263, #2279, #2289, #2280. #2269, #2294, #2296, #2297)
|
|
19
|
+
- `mathtex-script`: Use html 'defer' attribute (#2069)
|
|
20
|
+
- `auto-render`: do not touch text nodes w/o formulas (#2154)
|
|
21
|
+
- Move \global and \def to functions (#2138)
|
|
22
|
+
- Cleanup font build scripts & font updates (#2155, #2171, #2156)
|
|
23
|
+
- **BREAKING CHANGE:** old-style numerals are now available via `\mathnormal` instead of `\mathcal`
|
|
24
|
+
- Upgrade minimum development Node version to v10 (#2177)
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
- **BREAKING CHANGE:** IE 9/10 support (#2136)
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- Set `border-collapse: collapse` in vlist, fix misalignment in table (#2103)
|
|
31
|
+
- `\@ifnextchar` consumes spaces (#2118)
|
|
32
|
+
- Add spacing on left of fleqn display math (#2127)
|
|
33
|
+
- Fix `\boxed` inherited color (#2130)
|
|
34
|
+
- Fix laps having visible width in Safari (#1919)
|
|
35
|
+
- Improve MathML for corners (#1922)
|
|
36
|
+
- `auto-render`: ignore "option" tags (#2180)
|
|
37
|
+
- Fix delimiter error message (#2186)
|
|
38
|
+
- Fix under accent depth (#2252)
|
|
39
|
+
- Enable empty environment (#2258)
|
|
40
|
+
- Enable an empty `\substack` (#2278)
|
|
41
|
+
- Fix jagged parentheses (#2234)
|
|
42
|
+
- `\boldsymbol` not italic for textords such as Greek (#2290, #2299)
|
|
43
|
+
- Protect fraction bars from CSS border-color (#2292)
|
|
44
|
+
- Reset to leftmost spacing mode after newline (#1841)
|
|
45
|
+
- Fix missing metrics for space (0x20) and no-break space (0xa0) (#2298)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## [v0.11.1]
|
|
49
|
+
### Changed
|
|
50
|
+
- [Security] Bump mixin-deep from 1.3.1 to 1.3.2 (#2090)
|
|
51
|
+
- [Security] Bump eslint-utils from 1.3.1 to 1.4.2 (#2089)
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
- Fix parse timing by separating consume() into fetch() and consume() (#2054)
|
|
55
|
+
- Use current font for accents (#2066)
|
|
56
|
+
- Fix \gray's macro definition (#2075)
|
|
57
|
+
|
|
58
|
+
## [v0.11.0]
|
|
59
|
+
### Added
|
|
60
|
+
- **BREAKING CHANGE:** trust setting to indicate whether input text is trusted (#1794)
|
|
61
|
+
- `\href` and `\url` will break without adjusting the trust setting
|
|
62
|
+
- Add test for double square brackets to katex-spec (#1956)
|
|
63
|
+
- Add option to render only MathML so that its visible (#1966)
|
|
64
|
+
- Support {smallmatrix}, {subarray}, and \substack (#1969)
|
|
65
|
+
- Enable minRuleThickness in rendering options (#1964)
|
|
66
|
+
- Add \plim (#1952)
|
|
67
|
+
- Support Unicode \digamma (#2010)
|
|
68
|
+
- Support \operatorname* (#1899)
|
|
69
|
+
- Support \includegraphics, with appropriate trust setting (#2053)
|
|
70
|
+
- Add render-a11y-string add-on (#2062)
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
- DOC: Fix path to built file (#1976)
|
|
74
|
+
- Remove unclosed TODO comment (#1979)
|
|
75
|
+
- Add "Tutti Quanti Shelf" app to users page (#1997)
|
|
76
|
+
- Document mhchem \cf not supported (use \ce instead) (#2008)
|
|
77
|
+
- Replace greenkeeper badge with dependabot badge (#2022)
|
|
78
|
+
- Add Unicode digamma to documentation (#2045)
|
|
79
|
+
- Add katex-expression to libs page (#2049)
|
|
80
|
+
- Suggest <!DOCTYPE html> in documentation (#2052)
|
|
81
|
+
- Unicode characters in math render in text mode (#2040)
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
- Improve output of fonts in MathML (#1965)
|
|
85
|
+
- Fix \pmb (#1924)
|
|
86
|
+
- \color affects following \right, put array cells in their own groups (#1845)
|
|
87
|
+
- Improve MathML for classes (#1929)
|
|
88
|
+
- Prevent gaps in tall delimiters (#1986)
|
|
89
|
+
- Fix \sqrt SVG path (#2009)
|
|
90
|
+
- Do not force sizing groups to display inline-block (#2044)
|
|
91
|
+
- Fix font choice in operators like \log (e.g. \boldsymbol{\log}) (#2041)
|
|
92
|
+
- Fix argument font sizing in \fbox and \raisebox, fix font sizing in \TeX, \LaTeX, \KaTeX (#1787)
|
|
93
|
+
|
|
94
|
+
## [v0.10.2]
|
|
95
|
+
### Added
|
|
96
|
+
- Approximate font metrics only when metrics don't exist (#1898)
|
|
97
|
+
- Add KaTeX version to stylesheet and troubleshooting guide (#1893)
|
|
98
|
+
- Add symbol double square brackets (#1947, #1954)
|
|
99
|
+
- Support double-square curly braces (#1953)
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
- Upgrade minimum development Node version to v8 (#1861)
|
|
103
|
+
- Disable @babel/env debug (#1874)
|
|
104
|
+
- Add issue templates (#1862)
|
|
105
|
+
- Added 'katex-element' (#1905)
|
|
106
|
+
- Fix Users' logo and url (#1896)
|
|
107
|
+
- Load fonts before running screenshotter (#1891)
|
|
108
|
+
- Add Browserstack logo (#1879)
|
|
109
|
+
- Added Android library (#1943)
|
|
110
|
+
- Move custom colors used by Khan into macros.js (#1933)
|
|
111
|
+
- Test for duplicate symbols/macros (#1955)
|
|
112
|
+
- Include extensions mhchem & copy-tex in home-page (#1932)
|
|
113
|
+
|
|
114
|
+
### Fixed
|
|
115
|
+
- Fix \Rho (#1870)
|
|
116
|
+
- Fix nested \dfrac (#1825)
|
|
117
|
+
- Improve MathML accents (#1877)
|
|
118
|
+
- Improve MathML for \overset, \stackrel, and \underset (#1886)
|
|
119
|
+
- Fix \not (U+E020) RBearing (width) (#1878)
|
|
120
|
+
- Fix ApplyFunction character (#1890)
|
|
121
|
+
- Improve MathML for \limits (#1897)
|
|
122
|
+
- Improve MathML for \hphantom and \vphantom (#1883)
|
|
123
|
+
- Improve MathML for \coloneqq, \dblcolon, \eqcolon, and \eqqcolon (#1889)
|
|
124
|
+
- Improve MathML for \brace (#1884)
|
|
125
|
+
- Fix \middle spacing (#1906)
|
|
126
|
+
- Get a tall \middle\vert from MathML (#1911)
|
|
127
|
+
- Improve more coloneq (#1902)
|
|
128
|
+
- Make \smallint small in \displaystyle (#1907)
|
|
129
|
+
- Improve MathML for characters in Unicode private use area (#1908)
|
|
130
|
+
- Improve MathML for extensible arrows (#1901)
|
|
131
|
+
- Improve MathML for \rule (#1912)
|
|
132
|
+
- Improve MathML for fractions (#1882)
|
|
133
|
+
- Improve MathML for \tag (#1915)
|
|
134
|
+
- Improve MathML for \colorbox and \fcolorbox (#1914)
|
|
135
|
+
- Improve MathML for environments (#1910)
|
|
136
|
+
- Improve MathML for \genfrac barline (#1925)
|
|
137
|
+
- Support \textup and \textmd (#1921)
|
|
138
|
+
- Improve MathML for \not (#1923)
|
|
139
|
+
- Improve MathML for \Bbbk (#1930)
|
|
140
|
+
- Prevent inadvertent tall delims (#1948)
|
|
141
|
+
|
|
142
|
+
### Removed
|
|
143
|
+
- Re-added code for \includegraphics but disabled the function until trust settings is merged (#1951)
|
|
144
|
+
|
|
4
145
|
## [v0.10.1]
|
|
5
146
|
### Added
|
|
6
147
|
- ECMAScript module for contrib (#1624)
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2013-
|
|
3
|
+
Copyright (c) 2013-2019 Khan Academy and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
[](https://circleci.com/gh/KaTeX/KaTeX)
|
|
4
4
|
[](https://codecov.io/gh/KaTeX/KaTeX)
|
|
5
5
|
[](https://gitter.im/KaTeX/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
6
|
-
[](https://dependabot.com)
|
|
7
7
|
[](https://www.jsdelivr.com/package/npm/katex)
|
|
8
|
-

|
|
9
9
|
|
|
10
10
|
KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
|
|
11
11
|
|
|
@@ -14,7 +14,7 @@ KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the we
|
|
|
14
14
|
* **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
|
|
15
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.
|
|
16
16
|
|
|
17
|
-
KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE
|
|
17
|
+
KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 11.
|
|
18
18
|
|
|
19
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).
|
|
20
20
|
|
|
@@ -29,13 +29,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
|
|
|
29
29
|
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
|
|
30
30
|
<html>
|
|
31
31
|
<head>
|
|
32
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.
|
|
32
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
|
|
33
33
|
|
|
34
34
|
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
|
35
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
35
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
|
|
36
36
|
|
|
37
37
|
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
|
38
|
-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
38
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
|
|
39
39
|
onload="renderMathInElement(document.body);"></script>
|
|
40
40
|
</head>
|
|
41
41
|
...
|
package/cli.js
CHANGED
|
File without changes
|
|
@@ -19,6 +19,13 @@ const splitWithDelimiters = function(text, delimiters) {
|
|
|
19
19
|
*/
|
|
20
20
|
const renderMathInText = function(text, optionsCopy) {
|
|
21
21
|
const data = splitWithDelimiters(text, optionsCopy.delimiters);
|
|
22
|
+
if (data.length === 1 && data[0].type === 'text') {
|
|
23
|
+
// There is no formula in the text.
|
|
24
|
+
// Let's return null which means there is no need to replace
|
|
25
|
+
// the current text node with a new one.
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
const fragment = document.createDocumentFragment();
|
|
23
30
|
|
|
24
31
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -60,8 +67,10 @@ const renderElem = function(elem, optionsCopy) {
|
|
|
60
67
|
if (childNode.nodeType === 3) {
|
|
61
68
|
// Text node
|
|
62
69
|
const frag = renderMathInText(childNode.textContent, optionsCopy);
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
if (frag) {
|
|
71
|
+
i += frag.childNodes.length - 1;
|
|
72
|
+
elem.replaceChild(frag, childNode);
|
|
73
|
+
}
|
|
65
74
|
} else if (childNode.nodeType === 1) {
|
|
66
75
|
// Element node
|
|
67
76
|
const className = ' ' + childNode.className + ' ';
|
|
@@ -106,7 +115,7 @@ const renderMathInElement = function(elem, options) {
|
|
|
106
115
|
{left: "\\[", right: "\\]", display: true},
|
|
107
116
|
];
|
|
108
117
|
optionsCopy.ignoredTags = optionsCopy.ignoredTags || [
|
|
109
|
-
"script", "noscript", "style", "textarea", "pre", "code",
|
|
118
|
+
"script", "noscript", "style", "textarea", "pre", "code", "option",
|
|
110
119
|
];
|
|
111
120
|
optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
|
|
112
121
|
optionsCopy.errorCallback = optionsCopy.errorCallback || console.error;
|
|
@@ -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.12.0/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/copy-tex.min.js" integrity="sha384-XhWAe6BtVcvEdS3FFKT7Mcft4HJjPqMQvi5V4YhzH9Qxw497jC13TupOEvjoIPy7" crossorigin="anonymous"></script>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
See [index.html](index.html) for an example.
|
|
@@ -35,11 +35,9 @@ If you want to build your own custom copy handler based on this one,
|
|
|
35
35
|
copy the `copy-tex.js` into your codebase and replace the `require`
|
|
36
36
|
statement with `require('katex/contrib/copy-tex/katex2tex.js')`.
|
|
37
37
|
|
|
38
|
-
<!-- TODO: uncomment when releasing a new version
|
|
39
38
|
ECMAScript module is also available:
|
|
40
39
|
```html
|
|
41
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
42
|
-
```` -->
|
|
40
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/copy-tex.mjs" integrity="sha384-kS7UtO844uqLwxPmaRwzg1nGbKiHsIteWh+DP2cvT2FtigL0v6w1yPXYKEDzct0C" crossorigin="anonymous"></script>
|
|
43
41
|
|
|
44
42
|
### Known Issues
|
|
45
43
|
|
|
@@ -9,32 +9,30 @@ This extension isn't part of KaTeX proper, so the script should be separately
|
|
|
9
9
|
included in the page, in addition to KaTeX.
|
|
10
10
|
|
|
11
11
|
Load the extension by adding the following line to your HTML file.
|
|
12
|
-
This extension should be loaded *after* all `script type=math/tex` blocks that you want to render.
|
|
13
12
|
|
|
14
13
|
```html
|
|
15
|
-
<script src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
14
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-LJ2FmexL77rmGm6SIpxq7y+XA6bkLzGZEgCywzKOZG/ws4va9fUVu2neMjvc3zdv" crossorigin="anonymous"></script>
|
|
16
15
|
```
|
|
17
16
|
You can download the script and use it locally, or from a local KaTeX installation instead.
|
|
18
17
|
|
|
19
18
|
For example, in the following simple page, we first load KaTeX as usual.
|
|
20
19
|
Then, in the body, we use a `math/tex` script to typeset the equation `x+\sqrt{1-x^2}`.
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
|
|
23
22
|
```html
|
|
23
|
+
<!DOCTYPE html>
|
|
24
24
|
<html>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
<head>
|
|
26
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
|
|
27
|
+
<script src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
|
|
28
|
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-LJ2FmexL77rmGm6SIpxq7y+XA6bkLzGZEgCywzKOZG/ws4va9fUVu2neMjvc3zdv" crossorigin="anonymous"></script>
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<script type="math/tex">x+\sqrt{1-x^2}</script>
|
|
32
|
+
</body>
|
|
33
33
|
</html>
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
<!-- TODO: uncomment when releasing a new version
|
|
37
36
|
ECMAScript module is also available:
|
|
38
37
|
```html
|
|
39
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
40
|
-
```` -->
|
|
38
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/mathtex-script-type.mjs" integrity="sha384-qc7HqE4GHbr2H9R+C8mTSdJmkkZ9E1bkIRyRrxMsoj3dcbGjILzoXJGcBGGns1bk" crossorigin="anonymous"></script>
|
package/contrib/mhchem/README.md
CHANGED
|
@@ -7,13 +7,15 @@ 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`.
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/katex@0.
|
|
10
|
+
<script src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/mhchem.min.js" integrity="sha384-5gCAXJ0ZgozlShOzzT0OWArn7yCPGWVIvgo+BAd8NUKbCmulrJiQuCVR9cHlPHeG"></script>
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
### Syntax
|
|
14
14
|
|
|
15
15
|
See the [mhchem Manual](https://mhchem.github.io/MathJax-mhchem/) for a full explanation of the input syntax, with working examples. The manual also includes a demonstration box.
|
|
16
16
|
|
|
17
|
+
Note that old versions of `mhchem.sty` used `\cf` for chemical formula and `\ce` for chemical equations, but `\cf` has been deprecated in place of `\ce`. This extension supports only `\ce`. You can define a macro mapping `\cf` to `\ce` if needed.
|
|
18
|
+
|
|
17
19
|
### Browser Support
|
|
18
20
|
|
|
19
21
|
This extension has been tested on Chrome, Firefox, Opera, and Edge.
|