Socket
Socket
Sign inDemoInstall

katex

Package Overview
Dependencies
Maintainers
7
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

katex - npm Package Compare versions

Comparing version 0.15.0 to 0.15.1

6

contrib/copy-tex/README.md

@@ -24,4 +24,4 @@ # Copy-tex extension

```html
<link href="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/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.0/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.15.1/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.0/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.1/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.0/dist/katex.min.css" integrity="sha384-SfHjyzed8eCsTSa4t2GoMc4WnsCLa6cQpFqPRCaizz0FlQUOyafw/AyIUCQU/KuM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.js" integrity="sha384-JRVVAdBKoQa7uhd8heKqlQyzByQCC57fpvrCw9iSahjP5bLB5b+hX0klEdjZmsH6" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/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.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/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.0/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.1/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.0/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" 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.0/dist/katex.min.css" integrity="sha384-SfHjyzed8eCsTSa4t2GoMc4WnsCLa6cQpFqPRCaizz0FlQUOyafw/AyIUCQU/KuM" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.js" integrity="sha384-JRVVAdBKoQa7uhd8heKqlQyzByQCC57fpvrCw9iSahjP5bLB5b+hX0klEdjZmsH6" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" 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.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/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.0",
"version": "0.15.1",
"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.0/dist/katex.min.css" integrity="sha384-SfHjyzed8eCsTSa4t2GoMc4WnsCLa6cQpFqPRCaizz0FlQUOyafw/AyIUCQU/KuM" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.0/dist/katex.min.js" integrity="sha384-JRVVAdBKoQa7uhd8heKqlQyzByQCC57fpvrCw9iSahjP5bLB5b+hX0klEdjZmsH6" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" 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.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>

@@ -43,0 +43,0 @@ </head>

@@ -7,2 +7,3 @@ // @flow

import defineFunction from "../defineFunction";
import defineMacro from "../defineMacro";
import mathMLTree from "../mathMLTree";

@@ -12,2 +13,3 @@ import ParseError from "../ParseError";

import {checkSymbolNodeType} from "../parseNode";
import {Token} from "../Token";
import {calculateSize, makeEm} from "../units";

@@ -59,2 +61,14 @@ import utils from "../utils";

// autoTag (an argument to parseArray) can be one of three values:
// * undefined: Regular (not-top-level) array; no tags on each row
// * true: Automatic equation numbering, overridable by \tag
// * false: Tags allowed on each row, but no automatic numbering
// This function *doesn't* work with the "split" environment name.
function getAutoTag(name): ?boolean {
if (name.indexOf("ed") === -1) {
return name.indexOf("*") === -1;
}
// return undefined;
}
/**

@@ -74,3 +88,3 @@ * Parse the body of the environment, with rows delimited by \\ and

colSeparationType,
addEqnNum,
autoTag,
singleRow,

@@ -86,3 +100,3 @@ emptySingleRow,

colSeparationType?: ColSeparationType,
addEqnNum?: boolean,
autoTag?: ?boolean,
singleRow?: boolean,

@@ -124,2 +138,25 @@ emptySingleRow?: boolean,

const tags = (autoTag != null ? [] : undefined);
// amsmath uses \global\@eqnswtrue and \global\@eqnswfalse to represent
// whether this row should have an equation number. Simulate this with
// a \@eqnsw macro set to 1 or 0.
function beginRow() {
if (autoTag) {
parser.gullet.macros.set("\\@eqnsw", "1", true);
}
}
function endRow() {
if (tags) {
if (parser.gullet.macros.get("\\df@tag")) {
tags.push(parser.subparse([new Token("\\df@tag")]));
parser.gullet.macros.set("\\df@tag", undefined, true);
} else {
tags.push(Boolean(autoTag) &&
parser.gullet.macros.get("\\@eqnsw") === "1");
}
}
}
beginRow();
// Test for \hline at the top of the array.

@@ -163,2 +200,3 @@ hLinesBeforeRow.push(getHLines(parser));

} else if (next === "\\end") {
endRow();
// Arrays terminate newlines with `\crcr` which consumes a `\cr` if

@@ -189,2 +227,3 @@ // the last line is empty. However, AMS environments keep the

rowGaps.push(size ? size.value : null);
endRow();

@@ -196,2 +235,3 @@ // check for \hline(s) following the row separator

body.push(row);
beginRow();
} else {

@@ -219,3 +259,3 @@ throw new ParseError("Expected & or \\\\ or \\cr or \\end",

colSeparationType,
addEqnNum,
tags,
leqno,

@@ -352,13 +392,23 @@ };

const eqnNumSpans = [];
if (group.addEqnNum) {
// An environment with automatic equation numbers.
// Create node(s) that will trigger CSS counter increment.
const tagSpans = [];
if (group.tags && group.tags.some((tag) => tag)) {
// An environment with manual tags and/or automatic equation numbers.
// Create node(s), the latter of which trigger CSS counter increment.
for (r = 0; r < nr; ++r) {
const rw = body[r];
const shift = rw.pos - offset;
const eqnTag = buildCommon.makeSpan(["eqn-num"], [], options);
eqnTag.depth = rw.depth;
eqnTag.height = rw.height;
eqnNumSpans.push({type: "elem", elem: eqnTag, shift});
const tag = group.tags[r];
let tagSpan;
if (tag === true) { // automatic numbering
tagSpan = buildCommon.makeSpan(["eqn-num"], [], options);
} else if (tag === false) {
// \nonumber/\notag or starred environment
tagSpan = buildCommon.makeSpan([], [], options);
} else { // manual \tag
tagSpan = buildCommon.makeSpan([],
html.buildExpression(tag, options, true), options);
}
tagSpan.depth = rw.depth;
tagSpan.height = rw.height;
tagSpans.push({type: "elem", elem: tagSpan, shift});
}

@@ -479,3 +529,3 @@ }

if (!group.addEqnNum) {
if (tagSpans.length === 0) {
return buildCommon.makeSpan(["mord"], [body], options);

@@ -485,3 +535,3 @@ } else {

positionType: "individualShift",
children: eqnNumSpans,
children: tagSpans,
}, options);

@@ -510,3 +560,3 @@ eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options);

}
if (group.addEqnNum) {
if (group.tags && group.tags[i]) {
row.unshift(glue);

@@ -648,2 +698,3 @@ row.push(glue);

const separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align";
const isSplit = context.envName === "split";
const res = parseArray(context.parser,

@@ -653,6 +704,6 @@ {

addJot: true,
addEqnNum: context.envName === "align" || context.envName === "alignat",
autoTag: isSplit ? undefined : getAutoTag(context.envName),
emptySingleRow: true,
colSeparationType: separationType,
maxNumCols: context.envName === "split" ? 2 : undefined,
maxNumCols: isSplit ? 2 : undefined,
leqno: context.parser.settings.leqno,

@@ -1003,3 +1054,3 @@ },

colSeparationType: "gather",
addEqnNum: context.envName === "gather",
autoTag: getAutoTag(context.envName),
emptySingleRow: true,

@@ -1037,3 +1088,3 @@ leqno: context.parser.settings.leqno,

const res = {
addEqnNum: context.envName === "equation",
autoTag: getAutoTag(context.envName),
emptySingleRow: true,

@@ -1064,2 +1115,5 @@ singleRow: true,

defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
defineMacro("\\notag", "\\nonumber");
// Catch \hline outside array environment

@@ -1066,0 +1120,0 @@ defineFunction({

@@ -18,3 +18,3 @@ // @flow

builtins: Mapping<Value>;
undefStack: Mapping<Value>[];
undefStack: Mapping<?Value>[];

@@ -52,3 +52,3 @@ /**

if (undefs.hasOwnProperty(undef)) {
if (undefs[undef] === undefined) {
if (undefs[undef] == null) {
delete this.current[undef];

@@ -102,4 +102,5 @@ } else {

* operation at every level, so takes time linear in their number.
* A value of undefined means to delete existing definitions.
*/
set(name: string, value: Value, global: boolean = false) {
set(name: string, value: ?Value, global: boolean = false) {
if (global) {

@@ -125,4 +126,8 @@ // Global set is equivalent to setting in all groups. Simulate this

}
this.current[name] = value;
if (value == null) {
delete this.current[name];
} else {
this.current[name] = value;
}
}
}

@@ -42,3 +42,4 @@ // @flow

hLinesBeforeRow: Array<boolean[]>,
addEqnNum?: boolean,
// Whether each row should be automatically numbered, or an explicit tag
tags?: (boolean | AnyParseNode[])[],
leqno?: boolean,

@@ -45,0 +46,0 @@ isCD?: boolean,

@@ -153,2 +153,23 @@ // @flow

/**
* Fully parse a separate sequence of tokens as a separate job.
* Tokens should be specified in reverse order, as in a MacroDefinition.
*/
subparse(tokens: Token[]): AnyParseNode[] {
// Save the next token from the current job.
const oldToken = this.nextToken;
this.consume();
// Run the new job, terminating it with an excess '}'
this.gullet.pushToken(new Token("}"));
this.gullet.pushTokens(tokens);
const parse = this.parseExpression(false);
this.expect("}");
// Restore the next token from the current job.
this.nextToken = oldToken;
return parse;
}
static endOfExpression: string[] = ["}", "\\endgroup", "\\end", "\\right", "&"];

@@ -155,0 +176,0 @@

@@ -9,2 +9,3 @@ // @flow

import ParseError from "./ParseError";
import {Token} from "./Token";

@@ -38,3 +39,2 @@ import type Settings from "./Settings";

}
parser.gullet.feed("\\df@tag");
tree = [{

@@ -44,3 +44,3 @@ type: "tag",

body: tree,
tag: parser.parse(),
tag: parser.subparse([new Token("\\df@tag")]),
}];

@@ -47,0 +47,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc