mathjax-img
Advanced tools
Comparing version 4.0.0-1 to 4.0.0
@@ -5,2 +5,23 @@ # Changelog | ||
## [4.0.0](https://github.com/pkra/mathjax-img/compare/v4.0.0-1...v4.0.0) (2023-09-04) | ||
### ⚠ BREAKING CHANGES | ||
* Drops support for MathJax v3. | ||
### Features | ||
* add MathJaxv4-style browser build ([b589914](https://github.com/pkra/mathjax-img/commit/b589914b1ce74b011cfdad5f42e14bbfa7cac562)) | ||
### Bug Fixes | ||
* **img.ts:** adjust imports ([9d300f8](https://github.com/pkra/mathjax-img/commit/9d300f806e85b43dd520cde161d64017a92a04ff)) | ||
* **img.ts:** fix function declaration ([54252c2](https://github.com/pkra/mathjax-img/commit/54252c2a2c9e0a8c37725afaf8d24b728f889a53)) | ||
* **img.ts:** fix TS type errors ([10d0b91](https://github.com/pkra/mathjax-img/commit/10d0b91711acf33c293c25c63b6f58d7c4e3341c)) | ||
* Merge pull request #24 from pkra/mathjax4 ([b04eabf](https://github.com/pkra/mathjax-img/commit/b04eabf85862d3fa85fe55894714da076dc9f753)), closes [#24](https://github.com/pkra/mathjax-img/issues/24) | ||
## [4.0.0-1](https://github.com/pkra/mathjax-img/compare/v4.0.0-0...v4.0.0-1) (2023-08-14) | ||
@@ -7,0 +28,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Configuration } from "mathjax-full/js/input/tex/Configuration.js"; | ||
import { Configuration } from "mathjax-full/mjs/input/tex/Configuration.js"; | ||
export declare const configuration: Configuration; |
@@ -1,4 +0,4 @@ | ||
import { Configuration } from "mathjax-full/js/input/tex/Configuration.js"; | ||
import { CommandMap } from "mathjax-full/js/input/tex/SymbolMap.js"; | ||
import TexError from "mathjax-full/js/input/tex/TexError.js"; | ||
import { Configuration } from "mathjax-full/mjs/input/tex/Configuration.js"; | ||
import { CommandMap } from "mathjax-full/mjs/input/tex/SymbolMap.js"; | ||
import TexError from "mathjax-full/mjs/input/tex/TexError.js"; | ||
let imgMethods = {}; | ||
@@ -13,3 +13,3 @@ const CheckDimen = function (dimen) { | ||
}; | ||
imgMethods.Img = (parser, name) => { | ||
imgMethods.Img = function (parser, name) { | ||
const arg = parser.GetBrackets(name, ""); | ||
@@ -52,2 +52,2 @@ const def = { | ||
}); | ||
//# sourceMappingURL=img.js.map | ||
//# sourceMappingURL=img.js.map |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "4.0.0-1", | ||
"version": "4.0.0", | ||
"description": "img extension for MathJax's TeX input", | ||
@@ -28,11 +28,12 @@ "keywords": [ | ||
"devDependencies": { | ||
"mathjax-full": "4.0.0.-beta.3", | ||
"mathjax-full": "4.0.0-beta.3", | ||
"standard-version": "9.5.0", | ||
"terser-webpack-plugin": "5.3.0", | ||
"typescript": "5.1.6", | ||
"webpack": "5.67.0", | ||
"webpack-cli": "^4.9.1" | ||
"typescript-tools": "0.3.1", | ||
"webpack": "5.88.2", | ||
"webpack-cli": "^5.1.1" | ||
}, | ||
"scripts": { | ||
"build": "node ./node_modules/mathjax-full/components/bin/makeAll", | ||
"build": "npx tsc && node ./node_modules/mathjax-full/components/bin/makeAll --mjs components", | ||
"release": "standard-version", | ||
@@ -39,0 +40,0 @@ "test": "node test/base.js" |
@@ -25,4 +25,4 @@ # mathjax-img | ||
const { TeX } = require('mathjax/js/input/tex.js'); | ||
const img = require('mathjax-img').configuration; // OR import { configuration as img } from 'mathjax-img'; | ||
import { TeX } from 'mathjax/js/input/tex.js'; | ||
import { configuration as img } from 'mathjax-img'; | ||
const tex = new TeX({ | ||
@@ -41,3 +41,3 @@ packages: [img.name] | ||
load: ['[img]/img.min.js'], | ||
paths: {img: 'https://cdn.jsdelivr.net/npm/mathjax-img@3'} | ||
paths: {img: 'https://cdn.jsdelivr.net/npm/mathjax-img@4'} | ||
}, | ||
@@ -44,0 +44,0 @@ tex: { |
@@ -25,10 +25,8 @@ /************************************************************* | ||
import { Configuration } from "mathjax-full/mjs/input/tex/Configuration.js"; | ||
import { CommandMap } from "mathjax-full/mjs/input/tex/SymbolMap.js"; | ||
import TexError from "mathjax-full/mjs/input/tex/TexError.js"; | ||
import TexParser from "mathjax-full/mjs/input/tex/TexParser.js"; | ||
import { ParseMethod } from "mathjax-full/mjs/input/tex/Types.js"; | ||
import { Configuration } from "mathjax-full/js/input/tex/Configuration.js"; | ||
import { CommandMap } from "mathjax-full/js/input/tex/SymbolMap.js"; | ||
import TexError from "mathjax-full/js/input/tex/TexError.js"; | ||
import TexParser from "mathjax-full/js/input/tex/TexParser.js"; | ||
import { ParseMethod } from "mathjax-full/js/input/tex/Types.js"; | ||
let imgMethods: Record<string, ParseMethod> = {}; | ||
@@ -48,3 +46,3 @@ | ||
interface def { | ||
interface def extends Record<string, any> { | ||
src: string; | ||
@@ -57,42 +55,38 @@ alt?: string; | ||
imgMethods.Img = (parser: TexParser, name: string) { | ||
const arg = parser.GetBrackets(name, ""); | ||
const def: def = { | ||
src: "", | ||
alt: "", | ||
valign: "", | ||
width: "", | ||
height: "", | ||
}; | ||
if (arg.match(/[,=]/)) { | ||
for (const pair of arg.split(/\s*,\s*/)) { | ||
const [key, ...value] = pair.split(/\s*=\s*/); | ||
if (!def.hasOwnProperty(key)) | ||
throw new TexError( | ||
"UnknownKey", | ||
'Unknown parameter "%1" in %2', | ||
key, | ||
name | ||
); | ||
def[key] = CheckDimen(value.join("=")); | ||
} | ||
} else { | ||
def.valign = CheckDimen(arg); | ||
def.width = CheckDimen(parser.GetBrackets(name, "")); | ||
def.height = CheckDimen(parser.GetBrackets(name, "")); | ||
imgMethods.Img = function (parser: TexParser, name: string) { | ||
const arg = parser.GetBrackets(name, ""); | ||
const def: def = { | ||
src: "", | ||
alt: "", | ||
valign: "", | ||
width: "", | ||
height: "", | ||
}; | ||
if (arg.match(/[,=]/)) { | ||
for (const pair of arg.split(/\s*,\s*/)) { | ||
const [key, ...value] = pair.split(/\s*=\s*/); | ||
if (!def.hasOwnProperty(key)) | ||
throw new TexError( | ||
"UnknownKey", | ||
'Unknown parameter "%1" in %2', | ||
key, | ||
name | ||
); | ||
def[key] = CheckDimen(value.join("=")); | ||
} | ||
def.alt = parser.GetBrackets(name, ""); | ||
def.src = parser.GetArgument(name); | ||
if (!def.valign) delete def.valign; | ||
if (!def.width) delete def.width; | ||
if (!def.height) delete def.height; | ||
if (!def.alt) delete def.alt; | ||
parser.Push(parser.create("token", "mglyph", def)); | ||
}; | ||
} else { | ||
def.valign = CheckDimen(arg); | ||
def.width = CheckDimen(parser.GetBrackets(name, "")); | ||
def.height = CheckDimen(parser.GetBrackets(name, "")); | ||
} | ||
def.alt = parser.GetBrackets(name, ""); | ||
def.src = parser.GetArgument(name); | ||
if (!def.valign) delete def.valign; | ||
if (!def.width) delete def.width; | ||
if (!def.height) delete def.height; | ||
if (!def.alt) delete def.alt; | ||
parser.Push(parser.create("token", "mglyph", def)); | ||
}; | ||
new CommandMap( | ||
"img", | ||
{ img: "Img" }, | ||
imgMethods | ||
); | ||
new CommandMap("img", { img: "Img" }, imgMethods); | ||
@@ -99,0 +93,0 @@ export const configuration = Configuration.create("img", { |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
36871
18
236
0
7