@unified-latex/unified-latex-util-parse 1.0.5 → 1.0.8
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/{dist/index.cjs.map → index.cjs.map} +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/index.js.map → index.js.map} +0 -0
- package/{dist/libs → libs}/compiler-ast.d.ts +0 -0
- package/{dist/libs → libs}/compiler-ast.d.ts.map +0 -0
- package/{dist/libs → libs}/parse-math.d.ts +0 -0
- package/{dist/libs → libs}/parse-math.d.ts.map +0 -0
- package/{dist/libs → libs}/parse-minimal.d.ts +0 -0
- package/{dist/libs → libs}/parse-minimal.d.ts.map +0 -0
- package/{dist/libs → libs}/parse.d.ts +0 -0
- package/{dist/libs → libs}/parse.d.ts.map +0 -0
- package/{dist/libs → libs}/plugin-from-string-minimal.d.ts +0 -0
- package/{dist/libs → libs}/plugin-from-string-minimal.d.ts.map +0 -0
- package/{dist/libs → libs}/plugin-from-string.d.ts +0 -0
- package/{dist/libs → libs}/plugin-from-string.d.ts.map +0 -0
- package/{dist/libs → libs}/process-macros-and-environments.d.ts +0 -0
- package/{dist/libs → libs}/process-macros-and-environments.d.ts.map +0 -0
- package/{dist/libs → libs}/reparse-math.d.ts +0 -0
- package/{dist/libs → libs}/reparse-math.d.ts.map +0 -0
- package/package.json +33 -45
- package/README.md +0 -170
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,44 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unified-latex/unified-latex-util-parse",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Tools for manipulating unified-latex ASTs",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@unified-latex/unified-latex-ctan": "^1.0.
|
|
9
|
-
"@unified-latex/unified-latex-types": "^1.0.
|
|
10
|
-
"@unified-latex/unified-latex-util-arguments": "^1.0.
|
|
11
|
-
"@unified-latex/unified-latex-util-environments": "^1.0.
|
|
12
|
-
"@unified-latex/unified-latex-util-match": "^1.0.
|
|
13
|
-
"@unified-latex/unified-latex-util-pegjs": "^1.0.
|
|
14
|
-
"@unified-latex/unified-latex-util-print-raw": "^1.0.
|
|
15
|
-
"@unified-latex/unified-latex-util-trim": "^1.0.
|
|
16
|
-
"@unified-latex/unified-latex-util-visit": "^1.0.
|
|
8
|
+
"@unified-latex/unified-latex-ctan": "^1.0.8",
|
|
9
|
+
"@unified-latex/unified-latex-types": "^1.0.7",
|
|
10
|
+
"@unified-latex/unified-latex-util-arguments": "^1.0.8",
|
|
11
|
+
"@unified-latex/unified-latex-util-environments": "^1.0.8",
|
|
12
|
+
"@unified-latex/unified-latex-util-match": "^1.0.8",
|
|
13
|
+
"@unified-latex/unified-latex-util-pegjs": "^1.0.8",
|
|
14
|
+
"@unified-latex/unified-latex-util-print-raw": "^1.0.8",
|
|
15
|
+
"@unified-latex/unified-latex-util-trim": "^1.0.8",
|
|
16
|
+
"@unified-latex/unified-latex-util-visit": "^1.0.8",
|
|
17
17
|
"unified": "^10.1.2"
|
|
18
18
|
},
|
|
19
|
-
"files": [
|
|
20
|
-
"dist/**/*.ts",
|
|
21
|
-
"dist/**/*.js",
|
|
22
|
-
"dist/**/*.map",
|
|
23
|
-
"dist/**/*.json"
|
|
24
|
-
],
|
|
25
|
-
"exports": {
|
|
26
|
-
".": {
|
|
27
|
-
"import": "./dist/index.js",
|
|
28
|
-
"require": "./dist/index.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./*js": "./dist/*js",
|
|
31
|
-
"./*": {
|
|
32
|
-
"import": "./dist/*.js",
|
|
33
|
-
"require": "./dist/*.cjs"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "npm run clean && mkdirp ./dist && npm run compile",
|
|
38
|
-
"clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
|
|
39
|
-
"compile": "tsc -b tsconfig.json & node build.js & wait",
|
|
40
|
-
"test": "jest"
|
|
41
|
-
},
|
|
42
19
|
"repository": {
|
|
43
20
|
"type": "git",
|
|
44
21
|
"url": "git+https://github.com/siefkenj/unified-latex.git"
|
|
@@ -57,15 +34,26 @@
|
|
|
57
34
|
"url": "https://github.com/siefkenj/unified-latex/issues"
|
|
58
35
|
},
|
|
59
36
|
"homepage": "https://github.com/siefkenj/unified-latex#readme",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"import": "index.js",
|
|
40
|
+
"require": "index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./*js": "./*js",
|
|
43
|
+
"./*": {
|
|
44
|
+
"import": "./*/index.js",
|
|
45
|
+
"require": "./*/index.cjs",
|
|
46
|
+
"types": "./*/index.d.ts"
|
|
47
|
+
},
|
|
48
|
+
"./*/index": {
|
|
49
|
+
"import": "./*/index.js",
|
|
50
|
+
"require": "./*/index.cjs"
|
|
69
51
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"**/*.ts",
|
|
55
|
+
"**/*.js",
|
|
56
|
+
"**/*.map",
|
|
57
|
+
"**/*.json"
|
|
58
|
+
]
|
|
59
|
+
}
|
package/README.md
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
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-util-parse
|
|
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-util-parse
|
|
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
|
-
# Plugins
|
|
26
|
-
|
|
27
|
-
## `unifiedLatexAstComplier`
|
|
28
|
-
|
|
29
|
-
Unified complier plugin that passes through a LaTeX AST without modification.
|
|
30
|
-
|
|
31
|
-
### Usage
|
|
32
|
-
|
|
33
|
-
`unified().use(unifiedLatexAstComplier)`
|
|
34
|
-
|
|
35
|
-
### Type
|
|
36
|
-
|
|
37
|
-
`Plugin<void[], Ast.Root, Ast.Root>`
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
function unifiedLatexAstComplier(): void;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## `unifiedLatexFromString`
|
|
44
|
-
|
|
45
|
-
Parse a string to a LaTeX AST.
|
|
46
|
-
|
|
47
|
-
### Usage
|
|
48
|
-
|
|
49
|
-
`unified().use(unifiedLatexFromString[, options])`
|
|
50
|
-
|
|
51
|
-
#### options
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
{ mode?: "math" | "regular"; macros?: Ast.MacroInfoRecord; environments?: Ast.EnvInfoRecord; }
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Type
|
|
58
|
-
|
|
59
|
-
`Plugin<{ mode?: "math" | "regular"; macros?: Ast.MacroInfoRecord; environments?: Ast.EnvInfoRecord; }[], string, Ast.Root>`
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
function unifiedLatexFromString(options: {
|
|
63
|
-
mode?: "math" | "regular";
|
|
64
|
-
macros?: Ast.MacroInfoRecord;
|
|
65
|
-
environments?: Ast.EnvInfoRecord;
|
|
66
|
-
}): void;
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## `unifiedLatexFromStringMinimal`
|
|
70
|
-
|
|
71
|
-
Parse a string to a LaTeX AST with no post processing. For example,
|
|
72
|
-
no macro arguments will be attached, etc.
|
|
73
|
-
|
|
74
|
-
### Usage
|
|
75
|
-
|
|
76
|
-
`unified().use(unifiedLatexFromStringMinimal[, options])`
|
|
77
|
-
|
|
78
|
-
#### options
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
PluginOptions
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Type
|
|
85
|
-
|
|
86
|
-
`Plugin<PluginOptions[], string, Ast.Root>`
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
function unifiedLatexFromStringMinimal(options: PluginOptions): void;
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
# Functions
|
|
93
|
-
|
|
94
|
-
## `parse(str)`
|
|
95
|
-
|
|
96
|
-
Parse the string into an AST.
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
function parse(str: String): Ast.Root;
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**Parameters**
|
|
103
|
-
|
|
104
|
-
| Param | Type |
|
|
105
|
-
| :---- | :------- |
|
|
106
|
-
| str | `String` |
|
|
107
|
-
|
|
108
|
-
## `parseMath(str)`
|
|
109
|
-
|
|
110
|
-
Parse `str` into an AST. Parsing starts in math mode and a list of
|
|
111
|
-
nodes is returned (instead of a "root" node).
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
function parseMath(str: string | Ast.Ast): Ast.Node[];
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
**Parameters**
|
|
118
|
-
|
|
119
|
-
| Param | Type |
|
|
120
|
-
| :---- | :------------------ |
|
|
121
|
-
| str | `string \| Ast.Ast` |
|
|
122
|
-
|
|
123
|
-
## `parseMathMinimal(str)`
|
|
124
|
-
|
|
125
|
-
Parse `str` to an AST with minimal processing. E.g., macro
|
|
126
|
-
arguments are not attached to macros, etc. when parsed with this
|
|
127
|
-
function.
|
|
128
|
-
|
|
129
|
-
The parsing assumes a math-mode context, so, for example, `^` and `_` are
|
|
130
|
-
parsed as macros (even though arguments are not attached to them).
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
function parseMathMinimal(str: String): Ast.Node[];
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
**Parameters**
|
|
137
|
-
|
|
138
|
-
| Param | Type |
|
|
139
|
-
| :---- | :------- |
|
|
140
|
-
| str | `String` |
|
|
141
|
-
|
|
142
|
-
## `parseMinimal(str)`
|
|
143
|
-
|
|
144
|
-
Parse `str` to an AST with minimal processing. E.g., macro
|
|
145
|
-
arguments are not attached to macros, etc. when parsed with this
|
|
146
|
-
function.
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
function parseMinimal(str: String): Ast.Root;
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Parameters**
|
|
153
|
-
|
|
154
|
-
| Param | Type |
|
|
155
|
-
| :---- | :------- |
|
|
156
|
-
| str | `String` |
|
|
157
|
-
|
|
158
|
-
# Types
|
|
159
|
-
|
|
160
|
-
## `PluginOptions`
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
export type PluginOptions =
|
|
164
|
-
| {
|
|
165
|
-
mode?: "math" | "regular";
|
|
166
|
-
macros?: MacroInfoRecord;
|
|
167
|
-
environments?: EnvInfoRecord;
|
|
168
|
-
}
|
|
169
|
-
| undefined;
|
|
170
|
-
```
|