@unified-latex/unified-latex 1.0.5
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/README.md +30 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +7 -0
- package/dist/libs/unified-latex.d.ts +11 -0
- package/dist/libs/unified-latex.d.ts.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!-- DO NOT MODIFY -->
|
|
2
|
+
<!-- This file was autogenerated by build-docs.ts -->
|
|
3
|
+
<!-- Edit the docstring in index.ts and regenerate -->
|
|
4
|
+
<!-- rather than editing this file directly. -->
|
|
5
|
+
# unified-latex
|
|
6
|
+
|
|
7
|
+
## What is this?
|
|
8
|
+
|
|
9
|
+
Functions parse strings to a `unified-latex` Abstract Syntax Tree (AST).
|
|
10
|
+
|
|
11
|
+
## When should I use this?
|
|
12
|
+
|
|
13
|
+
If you have a string that you would like to parse to a `unified-latex` `Ast.Ast`, or
|
|
14
|
+
if you are building a plugin for `unified()` that manipulates LaTeX.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @unified-latex/unified-latex
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This package contains both esm and commonjs exports. To explicitly access the esm export,
|
|
23
|
+
import the `.js` file. To explicitly access the commonjs export, import the `.cjs` file.
|
|
24
|
+
|
|
25
|
+
# Constants
|
|
26
|
+
|
|
27
|
+
| Name | Type | Description |
|
|
28
|
+
| :---------------------------- | :------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `processLatexToAstViaUnified` | `() => Processor<Ast.Root, Ast.Root, Ast.Root, void>` | Use `unified()` to a string to an `Ast.Ast` and then return it. This function
will not print/pretty-print the `Ast.Ast` back to a string. |
|
|
30
|
+
| `processLatexViaUnified` | `() => Processor<Ast.Root, Ast.Root, Ast.Root, string>` | Use `unified()` to a string to an `Ast.Ast` and then pretty-print it. |
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../index.ts", "../libs/unified-latex.ts"],
|
|
4
|
+
"sourcesContent": ["export * from \"./libs/unified-latex\";\n\n// NOTE: The docstring comment must be the last item in the index.ts file!\n/**\n * ## What is this?\n *\n * Functions parse strings to a `unified-latex` Abstract Syntax Tree (AST).\n *\n * ## When should I use this?\n *\n * If you have a string that you would like to parse to a `unified-latex` `Ast.Ast`, or\n * if you are building a plugin for `unified()` that manipulates LaTeX.\n */\n", "import { unified } from \"unified\";\nimport * as Ast from \"@unified-latex/unified-latex-types\";\nimport {\n unifiedLatexAstComplier,\n unifiedLatexFromString,\n} from \"@unified-latex/unified-latex-util-parse\";\nimport { unifiedLatexStringCompiler } from \"@unified-latex/unified-latex-util-to-string\";\n/**\n * Use `unified()` to a string to an `Ast.Ast` and then pretty-print it.\n */\nexport const processLatexViaUnified = () => {\n return unified()\n .use(unifiedLatexFromString)\n .use(unifiedLatexStringCompiler, { pretty: true });\n};\n\n/**\n * Use `unified()` to a string to an `Ast.Ast` and then return it. This function\n * will not print/pretty-print the `Ast.Ast` back to a string.\n */\nexport const processLatexToAstViaUnified = () => {\n return unified().use(unifiedLatexFromString).use(unifiedLatexAstComplier);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAwB;AAExB,sCAGO;AACP,0CAA2C;AAIpC,IAAM,yBAAyB,MAAM;AACxC,SAAO,4BAAQ,EACV,IAAI,sDAAsB,EAC1B,IAAI,gEAA4B,EAAE,QAAQ,KAAK,CAAC;AACzD;AAMO,IAAM,8BAA8B,MAAM;AAC7C,SAAO,4BAAQ,EAAE,IAAI,sDAAsB,EAAE,IAAI,uDAAuB;AAC5E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./libs/unified-latex";
|
|
2
|
+
/**
|
|
3
|
+
* ## What is this?
|
|
4
|
+
*
|
|
5
|
+
* Functions parse strings to a `unified-latex` Abstract Syntax Tree (AST).
|
|
6
|
+
*
|
|
7
|
+
* ## When should I use this?
|
|
8
|
+
*
|
|
9
|
+
* If you have a string that you would like to parse to a `unified-latex` `Ast.Ast`, or
|
|
10
|
+
* if you are building a plugin for `unified()` that manipulates LaTeX.
|
|
11
|
+
*/
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AAGrC;;;;;;;;;GASG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// libs/unified-latex.ts
|
|
2
|
+
import { unified } from "unified";
|
|
3
|
+
import {
|
|
4
|
+
unifiedLatexAstComplier,
|
|
5
|
+
unifiedLatexFromString
|
|
6
|
+
} from "@unified-latex/unified-latex-util-parse";
|
|
7
|
+
import { unifiedLatexStringCompiler } from "@unified-latex/unified-latex-util-to-string";
|
|
8
|
+
var processLatexViaUnified = () => {
|
|
9
|
+
return unified().use(unifiedLatexFromString).use(unifiedLatexStringCompiler, { pretty: true });
|
|
10
|
+
};
|
|
11
|
+
var processLatexToAstViaUnified = () => {
|
|
12
|
+
return unified().use(unifiedLatexFromString).use(unifiedLatexAstComplier);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
processLatexToAstViaUnified,
|
|
16
|
+
processLatexViaUnified
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../libs/unified-latex.ts"],
|
|
4
|
+
"sourcesContent": ["import { unified } from \"unified\";\nimport * as Ast from \"@unified-latex/unified-latex-types\";\nimport {\n unifiedLatexAstComplier,\n unifiedLatexFromString,\n} from \"@unified-latex/unified-latex-util-parse\";\nimport { unifiedLatexStringCompiler } from \"@unified-latex/unified-latex-util-to-string\";\n/**\n * Use `unified()` to a string to an `Ast.Ast` and then pretty-print it.\n */\nexport const processLatexViaUnified = () => {\n return unified()\n .use(unifiedLatexFromString)\n .use(unifiedLatexStringCompiler, { pretty: true });\n};\n\n/**\n * Use `unified()` to a string to an `Ast.Ast` and then return it. This function\n * will not print/pretty-print the `Ast.Ast` back to a string.\n */\nexport const processLatexToAstViaUnified = () => {\n return unified().use(unifiedLatexFromString).use(unifiedLatexAstComplier);\n};\n"],
|
|
5
|
+
"mappings": ";AAAA;AAEA;AAAA;AAAA;AAAA;AAIA;AAIO,IAAM,yBAAyB,MAAM;AACxC,SAAO,QAAQ,EACV,IAAI,sBAAsB,EAC1B,IAAI,4BAA4B,EAAE,QAAQ,KAAK,CAAC;AACzD;AAMO,IAAM,8BAA8B,MAAM;AAC7C,SAAO,QAAQ,EAAE,IAAI,sBAAsB,EAAE,IAAI,uBAAuB;AAC5E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Ast from "@unified-latex/unified-latex-types";
|
|
2
|
+
/**
|
|
3
|
+
* Use `unified()` to a string to an `Ast.Ast` and then pretty-print it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const processLatexViaUnified: () => import("unified").Processor<Ast.Root, Ast.Root, Ast.Root, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Use `unified()` to a string to an `Ast.Ast` and then return it. This function
|
|
8
|
+
* will not print/pretty-print the `Ast.Ast` back to a string.
|
|
9
|
+
*/
|
|
10
|
+
export declare const processLatexToAstViaUnified: () => import("unified").Processor<Ast.Root, Ast.Root, Ast.Root, void>;
|
|
11
|
+
//# sourceMappingURL=unified-latex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-latex.d.ts","sourceRoot":"","sources":["../../libs/unified-latex.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAM1D;;GAEG;AACH,eAAO,MAAM,sBAAsB,yEAIlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,uEAEvC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unified-latex/unified-latex",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Process LaTeX to an AST or a string",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@unified-latex/unified-latex-types": "^1.0.5",
|
|
9
|
+
"@unified-latex/unified-latex-util-parse": "^1.0.5",
|
|
10
|
+
"@unified-latex/unified-latex-util-to-string": "^1.0.5",
|
|
11
|
+
"unified": "^10.1.2"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/**/*.ts",
|
|
15
|
+
"dist/**/*.js",
|
|
16
|
+
"dist/**/*.map",
|
|
17
|
+
"dist/**/*.json"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./*js": "./dist/*js",
|
|
25
|
+
"./*": {
|
|
26
|
+
"import": "./dist/*.js",
|
|
27
|
+
"require": "./dist/*.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "npm run clean && mkdirp ./dist && npm run compile",
|
|
32
|
+
"clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
|
|
33
|
+
"compile": "tsc -b tsconfig.json & node build.js & wait",
|
|
34
|
+
"test": "jest"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/siefkenj/unified-latex.git"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"pegjs",
|
|
42
|
+
"latex",
|
|
43
|
+
"parser",
|
|
44
|
+
"prettier",
|
|
45
|
+
"unified-latex",
|
|
46
|
+
"unified"
|
|
47
|
+
],
|
|
48
|
+
"author": "Jason Siefken",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/siefkenj/unified-latex/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/siefkenj/unified-latex#readme",
|
|
54
|
+
"jest": {
|
|
55
|
+
"transformIgnorePatterns": [
|
|
56
|
+
"node_modules/(?!unified|bail|is-plain-obj|trough|vfile.*|unist.*|hast.*|property-information|html-void-elements|.*-separated-tokens|.*entities.*|ccount|rehype*|string-width|strip-ansi|ansi-regex|supports-color)"
|
|
57
|
+
],
|
|
58
|
+
"transform": {
|
|
59
|
+
"\\.m?jsx?$": "esbuild-jest",
|
|
60
|
+
"latex.pegjs$": "<rootDir>/../../tests/pegjs-preprocessor-latex.js",
|
|
61
|
+
"\\.pegjs$": "<rootDir>/../../tests/pegjs-preprocessor.js",
|
|
62
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|