@wordpress/latex-to-mathml 1.2.0 → 1.2.1-next.2f1c7c01b.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/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/loader.js +2 -0
- package/build/loader.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/loader.js +1 -0
- package/build-module/loader.js.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/latex-to-mathml/src/index.ts
|
|
29
31
|
var index_exports = {};
|
|
30
32
|
__export(index_exports, {
|
|
31
33
|
default: () => latexToMathML
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport temml from 'temml';\n\n/**\n * Options for LaTeX to MathML conversion.\n */\nexport interface LatexToMathMLOptions {\n\t/**\n\t * Whether to render in display mode (block) or inline mode.\n\t * @default true\n\t */\n\tdisplayMode?: boolean;\n}\n\n/**\n * Converts LaTeX math syntax to MathML.\n *\n * @param latex - The LaTeX string to convert.\n * @param options - Conversion options.\n * @param options.displayMode\n * @return The MathML string.\n * @throws Will throw an error if the LaTeX is invalid.\n *\n * @example\n * ```js\n * import latexToMathML from '@wordpress/latex-to-mathml';\n *\n * const mathML = latexToMathML( 'x^2', { displayMode: false } );\n * ```\n */\nexport default function latexToMathML(\n\tlatex: string,\n\t{ displayMode = true }: LatexToMathMLOptions = {}\n): string {\n\tconst mathML = temml.renderToString( latex, {\n\t\tdisplayMode,\n\t\tannotate: true,\n\t\tthrowOnError: true,\n\t} );\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = mathML;\n\treturn doc.body.querySelector( 'math' )?.innerHTML ?? '';\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAkB;AA6BH,SAAR,cACN,OACA,EAAE,cAAc,KAAK,IAA0B,CAAC,GACvC;AACT,QAAM,SAAS,aAAAA,QAAM,eAAgB,OAAO;AAAA,IAC3C;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,EACf,CAAE;AACF,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAC3D,MAAI,KAAK,YAAY;AACrB,SAAO,IAAI,KAAK,cAAe,MAAO,GAAG,aAAa;AACvD;",
|
|
6
6
|
"names": ["temml"]
|
|
7
7
|
}
|
package/build/loader.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/latex-to-mathml/src/loader.ts
|
|
29
31
|
var loader_exports = {};
|
|
30
32
|
__export(loader_exports, {
|
|
31
33
|
default: () => loader
|
package/build/loader.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/loader.ts"],
|
|
4
4
|
"sourcesContent": ["export default function loader() {\n\treturn import( '@wordpress/latex-to-mathml' );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAe,SAAR,SAA0B;AAChC,SAAO,OAAQ,4BAA6B;AAC7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport temml from 'temml';\n\n/**\n * Options for LaTeX to MathML conversion.\n */\nexport interface LatexToMathMLOptions {\n\t/**\n\t * Whether to render in display mode (block) or inline mode.\n\t * @default true\n\t */\n\tdisplayMode?: boolean;\n}\n\n/**\n * Converts LaTeX math syntax to MathML.\n *\n * @param latex - The LaTeX string to convert.\n * @param options - Conversion options.\n * @param options.displayMode\n * @return The MathML string.\n * @throws Will throw an error if the LaTeX is invalid.\n *\n * @example\n * ```js\n * import latexToMathML from '@wordpress/latex-to-mathml';\n *\n * const mathML = latexToMathML( 'x^2', { displayMode: false } );\n * ```\n */\nexport default function latexToMathML(\n\tlatex: string,\n\t{ displayMode = true }: LatexToMathMLOptions = {}\n): string {\n\tconst mathML = temml.renderToString( latex, {\n\t\tdisplayMode,\n\t\tannotate: true,\n\t\tthrowOnError: true,\n\t} );\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = mathML;\n\treturn doc.body.querySelector( 'math' )?.innerHTML ?? '';\n}\n"],
|
|
5
|
-
"mappings": "AAGA,OAAO,WAAW;AA6BH,SAAR,cACN,OACA,EAAE,cAAc,KAAK,IAA0B,CAAC,GACvC;AACT,QAAM,SAAS,MAAM,eAAgB,OAAO;AAAA,IAC3C;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,EACf,CAAE;AACF,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAC3D,MAAI,KAAK,YAAY;AACrB,SAAO,IAAI,KAAK,cAAe,MAAO,GAAG,aAAa;AACvD;",
|
|
5
|
+
"mappings": ";AAGA,OAAO,WAAW;AA6BH,SAAR,cACN,OACA,EAAE,cAAc,KAAK,IAA0B,CAAC,GACvC;AACT,QAAM,SAAS,MAAM,eAAgB,OAAO;AAAA,IAC3C;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,EACf,CAAE;AACF,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAC3D,MAAI,KAAK,YAAY;AACrB,SAAO,IAAI,KAAK,cAAe,MAAO,GAAG,aAAa;AACvD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/loader.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/loader.ts"],
|
|
4
4
|
"sourcesContent": ["export default function loader() {\n\treturn import( '@wordpress/latex-to-mathml' );\n}\n"],
|
|
5
|
-
"mappings": "AAAe,SAAR,SAA0B;AAChC,SAAO,OAAQ,4BAA6B;AAC7C;",
|
|
5
|
+
"mappings": ";AAAe,SAAR,SAA0B;AAChC,SAAO,OAAQ,4BAA6B;AAC7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/latex-to-mathml",
|
|
3
|
-
"version": "1.2.0",
|
|
3
|
+
"version": "1.2.1-next.2f1c7c01b.0",
|
|
4
4
|
"description": "Convert LaTeX math syntax to MathML.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
|
|
50
50
|
}
|