Comparing version 0.15.5 to 0.15.6
@@ -24,4 +24,4 @@ # Copy-tex extension | ||
```html | ||
<link href="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script> | ||
<link href="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script> | ||
``` | ||
@@ -41,3 +41,3 @@ | ||
```html | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script> | ||
``` | ||
@@ -44,0 +44,0 @@ |
@@ -14,3 +14,3 @@ # `math/tex` Custom Script Type Extension | ||
```html | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script> | ||
``` | ||
@@ -27,5 +27,5 @@ You can download the script and use it locally, or from a local KaTeX installation instead. | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/katex.min.css" integrity="sha384-+Wlal0Ai0ogheUBCt+YhdEjW0Bw/wOomNjuLALBWHoQ7+4iKyrnXUQQxiJkqdFaW" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/katex.min.js" integrity="sha384-dQvryPZBf8c63m13UtoWUM65ls6EHpVDJOZzWvybzIVu+B7OjH4CqojrrdXFqxiJ" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.css" integrity="sha384-ZPe7yZ91iWxYumsBEOn7ieg8q/o+qh/hQpSaPow8T6BwALcXSCS6C6fSRPIAnTQs" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.js" integrity="sha384-ljao5I1l+8KYFXG7LNEA7DyaFvuvSCmedUf6Y6JI7LJqiu8q5dEivP2nDdFH31V4" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script> | ||
</head> | ||
@@ -40,2 +40,2 @@ <body> | ||
```html | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script> |
@@ -10,3 +10,3 @@ # mhchem extension | ||
```html | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/mhchem.min.js" integrity="sha384-RTN08a0AXIioPBcVosEqPUfKK+rPp+h1x/izR7xMkdMyuwkcZCWdxO+RSwIFtJXN" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/mhchem.min.js" integrity="sha384-RTN08a0AXIioPBcVosEqPUfKK+rPp+h1x/izR7xMkdMyuwkcZCWdxO+RSwIFtJXN" crossorigin="anonymous"></script> | ||
``` | ||
@@ -13,0 +13,0 @@ |
@@ -34,9 +34,9 @@ # [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/) | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/katex.min.css" integrity="sha384-+Wlal0Ai0ogheUBCt+YhdEjW0Bw/wOomNjuLALBWHoQ7+4iKyrnXUQQxiJkqdFaW" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.css" integrity="sha384-ZPe7yZ91iWxYumsBEOn7ieg8q/o+qh/hQpSaPow8T6BwALcXSCS6C6fSRPIAnTQs" crossorigin="anonymous"> | ||
<!-- The loading of KaTeX is deferred to speed up page rendering --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/katex.min.js" integrity="sha384-dQvryPZBf8c63m13UtoWUM65ls6EHpVDJOZzWvybzIVu+B7OjH4CqojrrdXFqxiJ" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.js" integrity="sha384-ljao5I1l+8KYFXG7LNEA7DyaFvuvSCmedUf6Y6JI7LJqiu8q5dEivP2nDdFH31V4" crossorigin="anonymous"></script> | ||
<!-- To automatically render math in text elements, include the auto-render extension: --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous" | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous" | ||
onload="renderMathInElement(document.body);"></script> | ||
@@ -43,0 +43,0 @@ </head> |
{ | ||
"name": "katex", | ||
"version": "0.15.5", | ||
"version": "0.15.6", | ||
"description": "Fast math typesetting for the web.", | ||
@@ -5,0 +5,0 @@ "main": "dist/katex.js", |
@@ -34,9 +34,9 @@ # [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/) | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/katex.min.css" integrity="sha384-+Wlal0Ai0ogheUBCt+YhdEjW0Bw/wOomNjuLALBWHoQ7+4iKyrnXUQQxiJkqdFaW" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.css" integrity="sha384-ZPe7yZ91iWxYumsBEOn7ieg8q/o+qh/hQpSaPow8T6BwALcXSCS6C6fSRPIAnTQs" crossorigin="anonymous"> | ||
<!-- The loading of KaTeX is deferred to speed up page rendering --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/katex.min.js" integrity="sha384-dQvryPZBf8c63m13UtoWUM65ls6EHpVDJOZzWvybzIVu+B7OjH4CqojrrdXFqxiJ" crossorigin="anonymous"></script> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/katex.min.js" integrity="sha384-ljao5I1l+8KYFXG7LNEA7DyaFvuvSCmedUf6Y6JI7LJqiu8q5dEivP2nDdFH31V4" crossorigin="anonymous"></script> | ||
<!-- To automatically render math in text elements, include the auto-render extension: --> | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.5/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous" | ||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.6/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous" | ||
onload="renderMathInElement(document.body);"></script> | ||
@@ -43,0 +43,0 @@ </head> |
@@ -65,2 +65,9 @@ // @flow | ||
/** | ||
* Fully expand the given token stream and return the resulting list of | ||
* tokens. Note that the input tokens are in reverse order, but the | ||
* output tokens are in forward order. | ||
*/ | ||
expandTokens(tokens: Token[]): Token[]; | ||
/** | ||
* Consume an argument from the token stream, and return the resulting array | ||
@@ -67,0 +74,0 @@ * of tokens and start/end token. |
@@ -359,3 +359,5 @@ // @flow | ||
/** | ||
* Fully expand the given token stream and return the resulting list of tokens | ||
* Fully expand the given token stream and return the resulting list of | ||
* tokens. Note that the input tokens are in reverse order, but the | ||
* output tokens are in forward order. | ||
*/ | ||
@@ -362,0 +364,0 @@ expandTokens(tokens: Token[]): Token[] { |
@@ -915,2 +915,54 @@ // @flow | ||
defineMacro("\\Ket", "\\left|#1\\right\\rangle"); | ||
const braketHelper = (one) => (context) => { | ||
const left = context.consumeArg().tokens; | ||
const middle = context.consumeArg().tokens; | ||
const middleDouble = context.consumeArg().tokens; | ||
const right = context.consumeArg().tokens; | ||
const oldMiddle = context.macros.get("|"); | ||
const oldMiddleDouble = context.macros.get("\\|"); | ||
context.macros.beginGroup(); | ||
const midMacro = (double) => (context) => { | ||
if (one) { | ||
// Only modify the first instance of | or \| | ||
context.macros.set("|", oldMiddle); | ||
if (middleDouble.length) { | ||
context.macros.set("\\|", oldMiddleDouble); | ||
} | ||
} | ||
let doubled = double; | ||
if (!double && middleDouble.length) { | ||
// Mimic \@ifnextchar | ||
const nextToken = context.future(); | ||
if (nextToken.text === "|") { | ||
context.popToken(); | ||
doubled = true; | ||
} | ||
} | ||
return { | ||
tokens: doubled ? middleDouble : middle, | ||
numArgs: 0, | ||
}; | ||
}; | ||
context.macros.set("|", midMacro(false)); | ||
if (middleDouble.length) { | ||
context.macros.set("\\|", midMacro(true)); | ||
} | ||
const arg = context.consumeArg().tokens; | ||
const expanded = context.expandTokens([ | ||
...right, ...arg, ...left, // reversed | ||
]); | ||
context.macros.endGroup(); | ||
return { | ||
tokens: expanded.reverse(), | ||
numArgs: 0, | ||
}; | ||
}; | ||
defineMacro("\\bra@ket", braketHelper(false)); | ||
defineMacro("\\bra@set", braketHelper(true)); | ||
defineMacro("\\Braket", "\\bra@ket{\\left\\langle}" + | ||
"{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"); | ||
defineMacro("\\Set", "\\bra@set{\\left\\{\\:}" + | ||
"{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"); | ||
defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"); | ||
// has no support for special || or \| | ||
@@ -917,0 +969,0 @@ ////////////////////////////////////////////////////////////////////// |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3938178
62950