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.13.23 to 0.13.24

6

contrib/copy-tex/README.md

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

```html
<link href="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/contrib/copy-tex.min.js" integrity="sha384-Ep9Es0VCjVn9dFeaN2uQxgGcGmG+pfZ4eBaHxUpxXDORrrVACZVOpywyzvFRGbmv" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/contrib/copy-tex.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.24/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.13.23/dist/contrib/copy-tex.mjs" integrity="sha384-+gSYJ3yzY30+a6FGYJXOx9swmWs5oPKEi1AeCsAxsLexABlUXgHXkOkEZCj0Lz8U" crossorigin="anonymous"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.13.24/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.13.23/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/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.13.23/dist/katex.min.css" integrity="sha384-z91AFMXXGZasvxZz5DtKJse3pKoTPU0QcNFj/B4gDFRmq6Q2bi1StsT7SOcIzLEN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/katex.min.js" integrity="sha384-Af7YmksQNWRLMvro3U9F84xa0paoIu7Pu2niAIUmZoI09Q4aCsbha5dvaj1tHy6K" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.23/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.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.js" integrity="sha384-y3g41vuZ3g2863mUshHxmagM9cH+0OMx0GV9fP/LMVwSVIeIVxvIfMaMReNn0jO+" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/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.13.23/dist/contrib/mathtex-script-type.mjs" integrity="sha384-4EJvC5tvqq9XJxXvdD4JutBokuFw/dCe2AB4gZ9sRpwFFXECpL3qT43tmE0PkpVg" crossorigin="anonymous"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/katex@0.13.24/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.13.23/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/contrib/mhchem.min.js" integrity="sha384-UEY9IRPkV+TTTY7nK1wSrfhWPDJy9wr4PmYg3DLPcN5F4NDlIwGZkWtWveKR/45c" crossorigin="anonymous"></script>
```

@@ -13,0 +13,0 @@

# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/main/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
[![Discussions](https://img.shields.io/badge/Discussions-join-brightgreen)](https://github.com/KaTeX/KaTeX/discussions)

@@ -34,9 +34,9 @@ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex)

<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/katex.min.css" integrity="sha384-z91AFMXXGZasvxZz5DtKJse3pKoTPU0QcNFj/B4gDFRmq6Q2bi1StsT7SOcIzLEN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/katex.min.js" integrity="sha384-Af7YmksQNWRLMvro3U9F84xa0paoIu7Pu2niAIUmZoI09Q4aCsbha5dvaj1tHy6K" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.js" integrity="sha384-y3g41vuZ3g2863mUshHxmagM9cH+0OMx0GV9fP/LMVwSVIeIVxvIfMaMReNn0jO+" 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.13.23/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/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.13.23",
"version": "0.13.24",
"description": "Fast math typesetting for the web.",

@@ -11,2 +11,6 @@ "main": "dist/katex.js",

},
"funding": [
"https://opencollective.com/katex",
"https://github.com/sponsors/katex"
],
"files": [

@@ -49,4 +53,6 @@ "katex.js",

"eslint": "^8.0.0",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-actions": "^2.0.0",
"eslint-plugin-flowtype": "^8.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-react": "^7.20.3",

@@ -53,0 +59,0 @@ "flow-bin": "^0.135.0",

# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/main/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
[![Discussions](https://img.shields.io/badge/Discussions-join-brightgreen)](https://github.com/KaTeX/KaTeX/discussions)

@@ -34,9 +34,9 @@ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex)

<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/katex.min.css" integrity="sha384-z91AFMXXGZasvxZz5DtKJse3pKoTPU0QcNFj/B4gDFRmq6Q2bi1StsT7SOcIzLEN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.23/dist/katex.min.js" integrity="sha384-Af7YmksQNWRLMvro3U9F84xa0paoIu7Pu2niAIUmZoI09Q4aCsbha5dvaj1tHy6K" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.js" integrity="sha384-y3g41vuZ3g2863mUshHxmagM9cH+0OMx0GV9fP/LMVwSVIeIVxvIfMaMReNn0jO+" 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.13.23/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>

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

@@ -12,3 +12,3 @@ // @flow

import {wideCharacterFont} from "./wide-character";
import {calculateSize} from "./units";
import {calculateSize, makeEm} from "./units";
import {DocumentFragment} from "./tree";

@@ -368,3 +368,3 @@

);
line.style.borderBottomWidth = line.height + "em";
line.style.borderBottomWidth = makeEm(line.height);
line.maxFontSize = 1.0;

@@ -555,3 +555,3 @@ return line;

const pstrut = makeSpan(["pstrut"], []);
pstrut.style.height = pstrutSize + "em";
pstrut.style.height = makeEm(pstrutSize);

@@ -573,3 +573,3 @@ // Create a new list of actual children at the correct offsets

const childWrap = makeSpan(classes, [pstrut, elem], undefined, style);
childWrap.style.top = (-pstrutSize - currPos - elem.depth) + "em";
childWrap.style.top = makeEm(-pstrutSize - currPos - elem.depth);
if (child.marginLeft) {

@@ -593,3 +593,3 @@ childWrap.style.marginLeft = child.marginLeft;

const vlist = makeSpan(["vlist"], realChildren);
vlist.style.height = maxPos + "em";
vlist.style.height = makeEm(maxPos);

@@ -606,3 +606,3 @@ // A second row is used if necessary to represent the vlist's depth.

const depthStrut = makeSpan(["vlist"], [emptySpan]);
depthStrut.style.height = -minPos + "em";
depthStrut.style.height = makeEm(-minPos);

@@ -635,3 +635,3 @@ // Safari wants the first row to have inline content; otherwise it

const size = calculateSize(measurement, options);
rule.style.marginRight = `${size}em`;
rule.style.marginRight = makeEm(size);
return rule;

@@ -754,6 +754,6 @@ };

const svgNode = new SvgNode([path], {
"width": width + "em",
"height": height + "em",
"width": makeEm(width),
"height": makeEm(height),
// Override CSS rule `.katex svg { width: 100% }`
"style": "width:" + width + "em",
"style": "width:" + makeEm(width),
"viewBox": "0 0 " + 1000 * width + " " + 1000 * height,

@@ -764,4 +764,4 @@ "preserveAspectRatio": "xMinYMin",

span.height = height;
span.style.height = height + "em";
span.style.width = width + "em";
span.style.height = makeEm(height);
span.style.width = makeEm(width);
return span;

@@ -768,0 +768,0 @@ };

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

import utils from "./utils";
import {makeEm} from "./units";
import {spacings, tightSpacings} from "./spacingData";

@@ -303,5 +304,5 @@ import {_htmlGroupBuilders as groupBuilders} from "./defineFunction";

const strut = makeSpan(["strut"]);
strut.style.height = (body.height + body.depth) + "em";
strut.style.height = makeEm(body.height + body.depth);
if (body.depth) {
strut.style.verticalAlign = -body.depth + "em";
strut.style.verticalAlign = makeEm(-body.depth);
}

@@ -400,5 +401,5 @@ body.children.unshift(strut);

const strut = tagChild.children[0];
strut.style.height = (htmlNode.height + htmlNode.depth) + "em";
strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
if (htmlNode.depth) {
strut.style.verticalAlign = (-htmlNode.depth) + "em";
strut.style.verticalAlign = makeEm(-htmlNode.depth);
}

@@ -405,0 +406,0 @@ }

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

import utils from "./utils";
import {makeEm} from "./units";
import fontMetricsData from "./fontMetricsData";

@@ -97,3 +98,3 @@

span.classes.push("delimcenter");
span.style.top = shift + "em";
span.style.top = makeEm(shift);
span.height -= shift;

@@ -191,10 +192,10 @@ span.depth += shift;

const width = fontMetricsData['Size4-Regular'][ch.charCodeAt(0)]
? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4].toFixed(3)
: fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4].toFixed(3);
? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4]
: fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4];
const path = new PathNode("inner", innerPath(ch, Math.round(1000 * height)));
const svgNode = new SvgNode([path], {
"width": width + "em",
"height": height + "em",
"width": makeEm(width),
"height": makeEm(height),
// Override CSS rule `.katex svg { width: 100% }`
"style": "width:" + width + "em",
"style": "width:" + makeEm(width),
"viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),

@@ -205,4 +206,4 @@ "preserveAspectRatio": "xMinYMin",

span.height = height;
span.style.height = height + "em";
span.style.width = width + "em";
span.style.height = makeEm(height);
span.style.width = makeEm(width);
return {type: "elem", elem: span};

@@ -434,3 +435,3 @@ };

"width": "400em",
"height": height + "em",
"height": makeEm(height),
"viewBox": "0 0 400000 " + viewBoxHeight,

@@ -522,3 +523,3 @@ "preserveAspectRatio": "xMinYMin slice",

span.height = texHeight;
span.style.height = spanHeight + "em";
span.style.height = makeEm(spanHeight);

@@ -525,0 +526,0 @@ return {

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

import {DocumentFragment} from "./tree";
import {makeEm} from "./units";

@@ -410,3 +411,3 @@ import type {VirtualNode} from "./tree";

span = document.createElement("span");
span.style.marginRight = this.italic + "em";
span.style.marginRight = makeEm(this.italic);
}

@@ -413,0 +414,0 @@

@@ -11,3 +11,3 @@ // @flow

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

@@ -372,3 +372,3 @@

colSep.style.width =
options.fontMetrics().doubleRuleSep + "em";
makeEm(options.fontMetrics().doubleRuleSep);
cols.push(colSep);

@@ -382,9 +382,9 @@ }

);
separator.style.height = totalHeight + "em";
separator.style.borderRightWidth = `${ruleThickness}em`;
separator.style.height = makeEm(totalHeight);
separator.style.borderRightWidth = makeEm(ruleThickness);
separator.style.borderRightStyle = lineType;
separator.style.margin = `0 -${ruleThickness / 2}em`;
separator.style.margin = `0 ${makeEm(-ruleThickness / 2)}`;
const shift = totalHeight - offset;
if (shift) {
separator.style.verticalAlign = -shift + "em";
separator.style.verticalAlign = makeEm(-shift);
}

@@ -412,3 +412,3 @@

colSep = buildCommon.makeSpan(["arraycolsep"], []);
colSep.style.width = sepwidth + "em";
colSep.style.width = makeEm(sepwidth);
cols.push(colSep);

@@ -444,3 +444,3 @@ }

colSep = buildCommon.makeSpan(["arraycolsep"], []);
colSep.style.width = sepwidth + "em";
colSep.style.width = makeEm(sepwidth);
cols.push(colSep);

@@ -531,3 +531,3 @@ }

: 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
table.setAttribute("rowspacing", gap.toFixed(4) + "em");
table.setAttribute("rowspacing", makeEm(gap));

@@ -534,0 +534,0 @@ // MathML table lines go only between cells.

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

import ParseError from "../ParseError";
import {makeEm} from "../units";

@@ -261,3 +262,3 @@ import type Parser from "../Parser";

label.classes.push("cd-label-" + group.side);
label.style.bottom = (0.8 - label.depth) + "em";
label.style.bottom = makeEm(0.8 - label.depth);
// Zero out label height & depth, so vertical align of arrow is set

@@ -264,0 +265,0 @@ // by the arrow height, not by the label.

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

import {assertSpan, assertSymbolDomNode} from "../domTree";
import {makeEm} from "../units";

@@ -135,3 +136,3 @@ import * as html from "../buildHTML";

accentBody.style.left = left + "em";
accentBody.style.left = makeEm(left);

@@ -166,4 +167,4 @@ // \textcircled uses the \bigcirc glyph, so it needs some

? {
width: `calc(100% - ${2 * skew}em)`,
marginLeft: `${(2 * skew)}em`,
width: `calc(100% - ${makeEm(2 * skew)})`,
marginLeft: makeEm(2 * skew),
}

@@ -170,0 +171,0 @@ : undefined,

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

import mathMLTree from "../mathMLTree";
import {calculateSize} from "../units";
import {calculateSize, makeEm} from "../units";
import {assertNodeType} from "../parseNode";

@@ -45,3 +45,3 @@

span.style.marginTop =
calculateSize(group.size, options) + "em";
makeEm(calculateSize(group.size, options));
}

@@ -58,3 +58,3 @@ }

node.setAttribute("height",
calculateSize(group.size, options) + "em");
makeEm(calculateSize(group.size, options)));
}

@@ -61,0 +61,0 @@ }

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

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

@@ -130,4 +131,5 @@ import * as html from "../buildHTML";

node.setAttribute("stretchy", "true");
node.setAttribute("minsize", delimiter.sizeToMaxHeight[group.size] + "em");
node.setAttribute("maxsize", delimiter.sizeToMaxHeight[group.size] + "em");
const size = makeEm(delimiter.sizeToMaxHeight[group.size]);
node.setAttribute("minsize", size);
node.setAttribute("maxsize", size);

@@ -134,0 +136,0 @@ return node;

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

import {PathNode, SvgNode} from "../domTree";
import {calculateSize} from "../units";
import {calculateSize, makeEm} from "../units";
import {assertNodeType} from "../parseNode";

@@ -52,3 +52,3 @@

// Reserve a left pad for the angle.
inner.style.paddingLeft = (angleHeight / 2 + lineWeight) + "em";
inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight);

@@ -60,3 +60,3 @@ // Create an SVG

"width": "400em",
"height": `${viewBoxHeight / 1000}em`,
"height": makeEm(viewBoxHeight / 1000),
"viewBox": `0 0 400000 ${viewBoxHeight}`,

@@ -67,3 +67,3 @@ "preserveAspectRatio": "xMinYMin slice",

img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options);
img.style.height = angleHeight + "em";
img.style.height = makeEm(angleHeight);
imgShift = inner.depth + lineWeight + clearance;

@@ -111,6 +111,6 @@

img.style.borderStyle = "solid";
img.style.borderWidth = `${ruleThickness}em`;
img.style.borderWidth = makeEm(ruleThickness);
} else if (label === "angl" && ruleThickness !== 0.049) {
img.style.borderTopWidth = `${ruleThickness}em`;
img.style.borderRightWidth = `${ruleThickness}em`;
img.style.borderTopWidth = makeEm(ruleThickness);
img.style.borderRightWidth = makeEm(ruleThickness);
}

@@ -117,0 +117,0 @@ imgShift = inner.depth + bottomPad;

@@ -12,3 +12,3 @@ // @flow

import * as mml from "../buildMathML";
import {calculateSize} from "../units";
import {calculateSize, makeEm} from "../units";

@@ -200,3 +200,3 @@ const adjustStyle = (size, originalStyle) => {

const ruleWidth = calculateSize(group.barSize, options);
node.setAttribute("linethickness", ruleWidth + "em");
node.setAttribute("linethickness", makeEm(ruleWidth));
}

@@ -203,0 +203,0 @@

// @flow
import defineFunction from "../defineFunction";
import type {Measurement} from "../units";
import {calculateSize, validUnit} from "../units";
import {calculateSize, validUnit, makeEm} from "../units";
import ParseError from "../ParseError";

@@ -111,3 +111,2 @@ import {Img} from "../domTree";

depth = calculateSize(group.totalheight, options) - height;
depth = Number(depth.toFixed(2));
}

@@ -120,8 +119,8 @@

const style: CssStyle = {height: height + depth + "em"};
const style: CssStyle = {height: makeEm(height + depth)};
if (width > 0) {
style.width = width + "em";
style.width = makeEm(width);
}
if (depth > 0) {
style.verticalAlign = -depth + "em";
style.verticalAlign = makeEm(-depth);
}

@@ -143,10 +142,9 @@

depth = calculateSize(group.totalheight, options) - height;
depth = depth.toFixed(2);
node.setAttribute("valign", "-" + depth + "em");
node.setAttribute("valign", makeEm(-depth));
}
node.setAttribute("height", height + depth + "em");
node.setAttribute("height", makeEm(height + depth));
if (group.width.number > 0) {
const width = calculateSize(group.width, options);
node.setAttribute("width", width + "em");
node.setAttribute("width", makeEm(width));
}

@@ -153,0 +151,0 @@ node.setAttribute("src", group.src);

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

import mathMLTree from "../mathMLTree";
import {makeEm} from "../units";

@@ -50,5 +51,5 @@ import * as html from "../buildHTML";

const strut = buildCommon.makeSpan(["strut"]);
strut.style.height = (node.height + node.depth) + "em";
strut.style.height = makeEm(node.height + node.depth);
if (node.depth) {
strut.style.verticalAlign = -node.depth + "em";
strut.style.verticalAlign = makeEm(-node.depth);
}

@@ -55,0 +56,0 @@ node.children.unshift(strut);

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

import {assertNodeType} from "../parseNode";
import {makeEm} from "../units";

@@ -136,3 +137,3 @@ import * as html from "../buildHTML";

base.style.position = "relative";
base.style.top = baseShift + "em";
base.style.top = makeEm(baseShift);
}

@@ -139,0 +140,0 @@

@@ -6,3 +6,3 @@ // @flow

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

@@ -39,5 +39,5 @@ defineFunction({

// Style the rule to the right size
rule.style.borderRightWidth = width + "em";
rule.style.borderTopWidth = height + "em";
rule.style.bottom = shift + "em";
rule.style.borderRightWidth = makeEm(width);
rule.style.borderTopWidth = makeEm(height);
rule.style.bottom = makeEm(shift);

@@ -63,13 +63,13 @@ // Record the height and width

rule.setAttribute("mathbackground", color);
rule.setAttribute("width", width + "em");
rule.setAttribute("height", height + "em");
rule.setAttribute("width", makeEm(width));
rule.setAttribute("height", makeEm(height));
const wrapper = new mathMLTree.MathNode("mpadded", [rule]);
if (shift >= 0) {
wrapper.setAttribute("height", "+" + shift + "em");
wrapper.setAttribute("height", makeEm(shift));
} else {
wrapper.setAttribute("height", shift + "em");
wrapper.setAttribute("depth", "+" + (-shift) + "em");
wrapper.setAttribute("height", makeEm(shift));
wrapper.setAttribute("depth", makeEm(-shift));
}
wrapper.setAttribute("voffset", shift + "em");
wrapper.setAttribute("voffset", makeEm(shift));

@@ -76,0 +76,0 @@ return wrapper;

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

import mathMLTree from "../mathMLTree";
import {makeEm} from "../units";

@@ -87,3 +88,3 @@ import * as html from "../buildHTML";

// this.
node.setAttribute("mathsize", newOptions.sizeMultiplier + "em");
node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier));

@@ -90,0 +91,0 @@ return node;

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

import Style from "../Style";
import {makeEm} from "../units";

@@ -74,3 +75,3 @@ import * as html from "../buildHTML";

inner.style.paddingLeft = advanceWidth + "em";
inner.style.paddingLeft = makeEm(advanceWidth);

@@ -77,0 +78,0 @@ // Overlay the image and the argument.

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

import utils from "../utils";
import {makeEm} from "../units";
import Style from "../Style";

@@ -115,3 +116,3 @@

const multiplier = options.sizeMultiplier;
const marginRight = (0.5 / metrics.ptPerEm) / multiplier + "em";
const marginRight = makeEm((0.5 / metrics.ptPerEm) / multiplier);

@@ -128,3 +129,3 @@ let marginLeft = null;

// $FlowFixMe
marginLeft = -base.italic + "em";
marginLeft = makeEm(-base.italic);
}

@@ -131,0 +132,0 @@ }

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

import type {AnyParseNode} from "../../parseNode";
import {makeEm} from "../../units";

@@ -66,7 +67,7 @@ // For an operator with limits, assemble the base, sup, and sub into a span.

{type: "kern", size: options.fontMetrics().bigOpSpacing5},
{type: "elem", elem: sub.elem, marginLeft: -slant + "em"},
{type: "elem", elem: sub.elem, marginLeft: makeEm(-slant)},
{type: "kern", size: sub.kern},
{type: "elem", elem: base},
{type: "kern", size: sup.kern},
{type: "elem", elem: sup.elem, marginLeft: slant + "em"},
{type: "elem", elem: sup.elem, marginLeft: makeEm(slant)},
{type: "kern", size: options.fontMetrics().bigOpSpacing5},

@@ -87,3 +88,3 @@ ],

{type: "kern", size: options.fontMetrics().bigOpSpacing5},
{type: "elem", elem: sub.elem, marginLeft: -slant + "em"},
{type: "elem", elem: sub.elem, marginLeft: makeEm(-slant)},
{type: "kern", size: sub.kern},

@@ -102,3 +103,3 @@ {type: "elem", elem: base},

{type: "kern", size: sup.kern},
{type: "elem", elem: sup.elem, marginLeft: slant + "em"},
{type: "elem", elem: sup.elem, marginLeft: makeEm(slant)},
{type: "kern", size: options.fontMetrics().bigOpSpacing5},

@@ -119,3 +120,3 @@ ],

const spacer = buildCommon.makeSpan(["mspace"], [], options);
spacer.style.marginRight = `${slant}em`;
spacer.style.marginRight = makeEm(slant);
parts.unshift(spacer);

@@ -122,0 +123,0 @@ }

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

import utils from "./utils";
import {makeEm} from "./units";
import ParseError from "./ParseError";

@@ -638,4 +639,4 @@

// \scriptstyle, which has a scale factor of 0.7 (see Options.js).
const latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] -
0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em";
const latexRaiseA = makeEm(fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] -
0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1]);
defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" +

@@ -642,0 +643,0 @@ `L\\kern-.36em\\raisebox{${latexRaiseA}}{\\scriptstyle A}` +

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

import {createClass} from "./domTree";
import {makeEm} from "./units";

@@ -223,3 +224,3 @@ import type {VirtualNode} from "./tree";

"http://www.w3.org/1998/Math/MathML", "mspace");
node.setAttribute("width", this.width + "em");
node.setAttribute("width", makeEm(this.width));
return node;

@@ -236,3 +237,3 @@ }

} else {
return `<mspace width="${this.width}em"/>`;
return `<mspace width="${makeEm(this.width)}"/>`;
}

@@ -239,0 +240,0 @@ }

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

import utils from "./utils";
import {makeEm} from "./units";

@@ -237,3 +238,3 @@ import type Options from "./Options";

"width": "100%",
"height": height + "em",
"height": makeEm(height),
"viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`,

@@ -279,3 +280,3 @@ "preserveAspectRatio": "none",

"width": "400em",
"height": height + "em",
"height": makeEm(height),
"viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`,

@@ -290,3 +291,3 @@ "preserveAspectRatio": aligns[i] + " slice",

} else {
span.style.height = height + "em";
span.style.height = makeEm(height);
spans.push(span);

@@ -308,5 +309,5 @@ }

span.height = height;
span.style.height = height + "em";
span.style.height = makeEm(height);
if (minWidth > 0) {
span.style.minWidth = minWidth + "em";
span.style.minWidth = makeEm(minWidth);
}

@@ -366,3 +367,3 @@

"width": "100%",
"height": totalHeight + "em",
"height": makeEm(totalHeight),
});

@@ -374,3 +375,3 @@

img.height = totalHeight;
img.style.height = totalHeight + "em";
img.style.height = makeEm(totalHeight);

@@ -377,0 +378,0 @@ return img;

@@ -99,1 +99,9 @@ // @flow

};
/**
* Round `n` to 4 decimal places, or to the nearest 1/10,000th em. See
* https://github.com/KaTeX/KaTeX/pull/2460.
*/
export const makeEm = function(n: number): string {
return +n.toFixed(4) + "em";
};

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