@isdk/mdast-plus 0.1.2 → 0.1.3
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.cn.md +54 -20
- package/README.md +54 -20
- package/dist/index.d.mts +187 -133
- package/dist/index.d.ts +187 -133
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +54 -20
- package/docs/_media/CONTRIBUTING.md +39 -18
- package/docs/_media/README.cn.md +54 -20
- package/docs/classes/MdastBasePipeline.md +348 -0
- package/docs/classes/MdastPipeline.md +531 -0
- package/docs/enumerations/PipelineStage.md +62 -0
- package/docs/functions/astCompiler.md +25 -0
- package/docs/functions/jsonParser.md +24 -0
- package/docs/functions/mdast.md +4 -4
- package/docs/globals.md +12 -10
- package/docs/interfaces/MdastDataOrigin.md +8 -8
- package/docs/interfaces/MdastFormat.md +71 -0
- package/docs/interfaces/MdastMark.md +4 -4
- package/docs/interfaces/MdastPlugin.md +27 -27
- package/docs/interfaces/MdastSub.md +4 -4
- package/docs/interfaces/MdastSup.md +4 -4
- package/docs/type-aliases/PipelineStageName.md +13 -0
- package/docs/variables/DefaultPipelineStage.md +13 -0
- package/docs/variables/astFormat.md +15 -0
- package/docs/variables/htmlFormat.md +6 -4
- package/docs/variables/markdownFormat.md +6 -4
- package/package.json +11 -9
- package/docs/classes/FluentProcessor.md +0 -210
- package/docs/functions/htmlStringify.md +0 -23
- package/docs/functions/markdownCommon.md +0 -23
- package/docs/interfaces/ConvertResult.md +0 -39
- package/docs/interfaces/MdastAsset.md +0 -41
- package/docs/interfaces/MdastFormatDefinition.md +0 -51
- package/docs/interfaces/MdastReader.md +0 -41
- package/docs/interfaces/MdastTransformer.md +0 -33
- package/docs/interfaces/MdastWriter.md +0 -47
- package/docs/type-aliases/Stage.md +0 -13
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
[**@isdk/mdast-plus**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/mdast-plus](../globals.md) / MdastPipeline
|
|
6
|
+
|
|
7
|
+
# Class: MdastPipeline
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:275](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L275)
|
|
10
|
+
|
|
11
|
+
Extended pipeline with convenience methods for common formats.
|
|
12
|
+
|
|
13
|
+
## Extends
|
|
14
|
+
|
|
15
|
+
- [`MdastBasePipeline`](MdastBasePipeline.md)
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new MdastPipeline**(`input`): `MdastPipeline`
|
|
22
|
+
|
|
23
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:53](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L53)
|
|
24
|
+
|
|
25
|
+
Initializes a new pipeline instance with the given input.
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
##### input
|
|
30
|
+
|
|
31
|
+
`Compatible`
|
|
32
|
+
|
|
33
|
+
Content to process (string, Buffer, VFile, or AST Node).
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`MdastPipeline`
|
|
38
|
+
|
|
39
|
+
#### Inherited from
|
|
40
|
+
|
|
41
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`constructor`](MdastBasePipeline.md#constructor)
|
|
42
|
+
|
|
43
|
+
## Properties
|
|
44
|
+
|
|
45
|
+
### input
|
|
46
|
+
|
|
47
|
+
> `protected` **input**: `Compatible`
|
|
48
|
+
|
|
49
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:46](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L46)
|
|
50
|
+
|
|
51
|
+
#### Inherited from
|
|
52
|
+
|
|
53
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`input`](MdastBasePipeline.md#input)
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### queue
|
|
58
|
+
|
|
59
|
+
> `protected` **queue**: [`MdastPlugin`](../interfaces/MdastPlugin.md)[] = `[]`
|
|
60
|
+
|
|
61
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:47](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L47)
|
|
62
|
+
|
|
63
|
+
#### Inherited from
|
|
64
|
+
|
|
65
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`queue`](MdastBasePipeline.md#queue)
|
|
66
|
+
|
|
67
|
+
## Methods
|
|
68
|
+
|
|
69
|
+
### assembleProcessor()
|
|
70
|
+
|
|
71
|
+
> `protected` **assembleProcessor**(`queue`): `Processor`
|
|
72
|
+
|
|
73
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:254](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L254)
|
|
74
|
+
|
|
75
|
+
Assembles a unified processor based on the sorted plugin queue.
|
|
76
|
+
|
|
77
|
+
#### Parameters
|
|
78
|
+
|
|
79
|
+
##### queue
|
|
80
|
+
|
|
81
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md)[]
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`Processor`
|
|
86
|
+
|
|
87
|
+
#### Inherited from
|
|
88
|
+
|
|
89
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`assembleProcessor`](MdastBasePipeline.md#assembleprocessor)
|
|
90
|
+
|
|
91
|
+
***
|
|
92
|
+
|
|
93
|
+
### ensureInputPlugins()
|
|
94
|
+
|
|
95
|
+
> `protected` **ensureInputPlugins**(`queue`, `overrides?`, `maxStage?`): `void`
|
|
96
|
+
|
|
97
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:123](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L123)
|
|
98
|
+
|
|
99
|
+
Ensures that input plugins (parser, normalizers) are present in the queue.
|
|
100
|
+
Adds implicit plugins if no parser is detected.
|
|
101
|
+
|
|
102
|
+
#### Parameters
|
|
103
|
+
|
|
104
|
+
##### queue
|
|
105
|
+
|
|
106
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md)[]
|
|
107
|
+
|
|
108
|
+
##### overrides?
|
|
109
|
+
|
|
110
|
+
`Record`\<`string`, `any`\>
|
|
111
|
+
|
|
112
|
+
##### maxStage?
|
|
113
|
+
|
|
114
|
+
[`PipelineStage`](../enumerations/PipelineStage.md) = `PipelineStage.stringify`
|
|
115
|
+
|
|
116
|
+
#### Returns
|
|
117
|
+
|
|
118
|
+
`void`
|
|
119
|
+
|
|
120
|
+
#### Inherited from
|
|
121
|
+
|
|
122
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`ensureInputPlugins`](MdastBasePipeline.md#ensureinputplugins)
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
126
|
+
### from()
|
|
127
|
+
|
|
128
|
+
> **from**(`fmt`, `overrides?`): `this`
|
|
129
|
+
|
|
130
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:152](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L152)
|
|
131
|
+
|
|
132
|
+
Configures the input format and adds its associated plugins to the pipeline.
|
|
133
|
+
|
|
134
|
+
#### Parameters
|
|
135
|
+
|
|
136
|
+
##### fmt
|
|
137
|
+
|
|
138
|
+
Format ID or definition.
|
|
139
|
+
|
|
140
|
+
`string` | [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
141
|
+
|
|
142
|
+
##### overrides?
|
|
143
|
+
|
|
144
|
+
`Record`\<`string`, `any`\>
|
|
145
|
+
|
|
146
|
+
Optional map to override plugin options by plugin name.
|
|
147
|
+
|
|
148
|
+
#### Returns
|
|
149
|
+
|
|
150
|
+
`this`
|
|
151
|
+
|
|
152
|
+
The pipeline instance for chaining.
|
|
153
|
+
|
|
154
|
+
#### Inherited from
|
|
155
|
+
|
|
156
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`from`](MdastBasePipeline.md#from)
|
|
157
|
+
|
|
158
|
+
***
|
|
159
|
+
|
|
160
|
+
### getFormat()
|
|
161
|
+
|
|
162
|
+
> **getFormat**(`id`): `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
163
|
+
|
|
164
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:60](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L60)
|
|
165
|
+
|
|
166
|
+
Instance-level access to the global format registry.
|
|
167
|
+
|
|
168
|
+
#### Parameters
|
|
169
|
+
|
|
170
|
+
##### id
|
|
171
|
+
|
|
172
|
+
`string`
|
|
173
|
+
|
|
174
|
+
#### Returns
|
|
175
|
+
|
|
176
|
+
`undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
177
|
+
|
|
178
|
+
#### Inherited from
|
|
179
|
+
|
|
180
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`getFormat`](MdastBasePipeline.md#getformat)
|
|
181
|
+
|
|
182
|
+
***
|
|
183
|
+
|
|
184
|
+
### priority()
|
|
185
|
+
|
|
186
|
+
> **priority**(`order`): `this`
|
|
187
|
+
|
|
188
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:242](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L242)
|
|
189
|
+
|
|
190
|
+
Sets the priority order for the most recently added plugin.
|
|
191
|
+
Plugins with lower order run earlier within the same stage.
|
|
192
|
+
|
|
193
|
+
#### Parameters
|
|
194
|
+
|
|
195
|
+
##### order
|
|
196
|
+
|
|
197
|
+
`number`
|
|
198
|
+
|
|
199
|
+
Numeric priority.
|
|
200
|
+
|
|
201
|
+
#### Returns
|
|
202
|
+
|
|
203
|
+
`this`
|
|
204
|
+
|
|
205
|
+
The pipeline instance for chaining.
|
|
206
|
+
|
|
207
|
+
#### Inherited from
|
|
208
|
+
|
|
209
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`priority`](MdastBasePipeline.md#priority)
|
|
210
|
+
|
|
211
|
+
***
|
|
212
|
+
|
|
213
|
+
### to()
|
|
214
|
+
|
|
215
|
+
> **to**(`fmt`, `overrides?`): `Promise`\<`VFile`\>
|
|
216
|
+
|
|
217
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:172](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L172)
|
|
218
|
+
|
|
219
|
+
Processes the pipeline and serializes the result into the specified format.
|
|
220
|
+
|
|
221
|
+
#### Parameters
|
|
222
|
+
|
|
223
|
+
##### fmt
|
|
224
|
+
|
|
225
|
+
Target format ID or definition.
|
|
226
|
+
|
|
227
|
+
`string` | [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
228
|
+
|
|
229
|
+
##### overrides?
|
|
230
|
+
|
|
231
|
+
`Record`\<`string`, `any`\>
|
|
232
|
+
|
|
233
|
+
Optional map to override plugin options.
|
|
234
|
+
|
|
235
|
+
#### Returns
|
|
236
|
+
|
|
237
|
+
`Promise`\<`VFile`\>
|
|
238
|
+
|
|
239
|
+
A promise resolving to a VFile containing the result.
|
|
240
|
+
|
|
241
|
+
#### Inherited from
|
|
242
|
+
|
|
243
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`to`](MdastBasePipeline.md#to)
|
|
244
|
+
|
|
245
|
+
***
|
|
246
|
+
|
|
247
|
+
### toAst()
|
|
248
|
+
|
|
249
|
+
> **toAst**(`options?`): `Promise`\<`Root`\>
|
|
250
|
+
|
|
251
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:312](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L312)
|
|
252
|
+
|
|
253
|
+
Finalizes the pipeline and returns the resulting AST (Root node).
|
|
254
|
+
|
|
255
|
+
#### Parameters
|
|
256
|
+
|
|
257
|
+
##### options?
|
|
258
|
+
|
|
259
|
+
Configuration for the extraction.
|
|
260
|
+
|
|
261
|
+
###### overrides?
|
|
262
|
+
|
|
263
|
+
`Record`\<`string`, `any`\>
|
|
264
|
+
|
|
265
|
+
Map for plugin option overrides.
|
|
266
|
+
|
|
267
|
+
###### stage?
|
|
268
|
+
|
|
269
|
+
`"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
270
|
+
|
|
271
|
+
Run the pipeline up to this stage only.
|
|
272
|
+
|
|
273
|
+
#### Returns
|
|
274
|
+
|
|
275
|
+
`Promise`\<`Root`\>
|
|
276
|
+
|
|
277
|
+
***
|
|
278
|
+
|
|
279
|
+
### toAST()
|
|
280
|
+
|
|
281
|
+
> **toAST**(`options?`): `Promise`\<`Root`\>
|
|
282
|
+
|
|
283
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:350](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L350)
|
|
284
|
+
|
|
285
|
+
Alias for toAst()
|
|
286
|
+
|
|
287
|
+
#### Parameters
|
|
288
|
+
|
|
289
|
+
##### options?
|
|
290
|
+
|
|
291
|
+
###### overrides?
|
|
292
|
+
|
|
293
|
+
`Record`\<`string`, `any`\>
|
|
294
|
+
|
|
295
|
+
###### stage?
|
|
296
|
+
|
|
297
|
+
`"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
298
|
+
|
|
299
|
+
#### Returns
|
|
300
|
+
|
|
301
|
+
`Promise`\<`Root`\>
|
|
302
|
+
|
|
303
|
+
***
|
|
304
|
+
|
|
305
|
+
### toHtml()
|
|
306
|
+
|
|
307
|
+
> **toHtml**(): `Promise`\<`string`\>
|
|
308
|
+
|
|
309
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:294](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L294)
|
|
310
|
+
|
|
311
|
+
Finalizes the pipeline and returns the result as an HTML string.
|
|
312
|
+
|
|
313
|
+
#### Returns
|
|
314
|
+
|
|
315
|
+
`Promise`\<`string`\>
|
|
316
|
+
|
|
317
|
+
***
|
|
318
|
+
|
|
319
|
+
### toHTML()
|
|
320
|
+
|
|
321
|
+
> **toHTML**(): `Promise`\<`string`\>
|
|
322
|
+
|
|
323
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:348](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L348)
|
|
324
|
+
|
|
325
|
+
Alias for toHtml()
|
|
326
|
+
|
|
327
|
+
#### Returns
|
|
328
|
+
|
|
329
|
+
`Promise`\<`string`\>
|
|
330
|
+
|
|
331
|
+
***
|
|
332
|
+
|
|
333
|
+
### toHtmlVFile()
|
|
334
|
+
|
|
335
|
+
> **toHtmlVFile**(): `Promise`\<`VFile`\>
|
|
336
|
+
|
|
337
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:302](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L302)
|
|
338
|
+
|
|
339
|
+
Finalizes the pipeline and returns a VFile containing the HTML result.
|
|
340
|
+
|
|
341
|
+
#### Returns
|
|
342
|
+
|
|
343
|
+
`Promise`\<`VFile`\>
|
|
344
|
+
|
|
345
|
+
***
|
|
346
|
+
|
|
347
|
+
### toMarkdown()
|
|
348
|
+
|
|
349
|
+
> **toMarkdown**(): `Promise`\<`string`\>
|
|
350
|
+
|
|
351
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:279](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L279)
|
|
352
|
+
|
|
353
|
+
Finalizes the pipeline and returns the result as a Markdown string.
|
|
354
|
+
|
|
355
|
+
#### Returns
|
|
356
|
+
|
|
357
|
+
`Promise`\<`string`\>
|
|
358
|
+
|
|
359
|
+
***
|
|
360
|
+
|
|
361
|
+
### toMarkdownVFile()
|
|
362
|
+
|
|
363
|
+
> **toMarkdownVFile**(): `Promise`\<`VFile`\>
|
|
364
|
+
|
|
365
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:287](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L287)
|
|
366
|
+
|
|
367
|
+
Finalizes the pipeline and returns a VFile containing the Markdown result.
|
|
368
|
+
|
|
369
|
+
#### Returns
|
|
370
|
+
|
|
371
|
+
`Promise`\<`VFile`\>
|
|
372
|
+
|
|
373
|
+
***
|
|
374
|
+
|
|
375
|
+
### toRuntimeEntry()
|
|
376
|
+
|
|
377
|
+
> `protected` **toRuntimeEntry**(`entry`, `defaultStage`, `overrides?`): [`MdastPlugin`](../interfaces/MdastPlugin.md) & `object`
|
|
378
|
+
|
|
379
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:84](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L84)
|
|
380
|
+
|
|
381
|
+
Normalizes a plugin entry for runtime execution.
|
|
382
|
+
|
|
383
|
+
#### Parameters
|
|
384
|
+
|
|
385
|
+
##### entry
|
|
386
|
+
|
|
387
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md)
|
|
388
|
+
|
|
389
|
+
##### defaultStage
|
|
390
|
+
|
|
391
|
+
[`PipelineStage`](../enumerations/PipelineStage.md)
|
|
392
|
+
|
|
393
|
+
##### overrides?
|
|
394
|
+
|
|
395
|
+
`Record`\<`string`, `any`\>
|
|
396
|
+
|
|
397
|
+
#### Returns
|
|
398
|
+
|
|
399
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md) & `object`
|
|
400
|
+
|
|
401
|
+
#### Inherited from
|
|
402
|
+
|
|
403
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`toRuntimeEntry`](MdastBasePipeline.md#toruntimeentry)
|
|
404
|
+
|
|
405
|
+
***
|
|
406
|
+
|
|
407
|
+
### use()
|
|
408
|
+
|
|
409
|
+
> **use**(`plugin`, ...`options`): `this`
|
|
410
|
+
|
|
411
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:215](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L215)
|
|
412
|
+
|
|
413
|
+
Adds a plugin to the pipeline's compile stage.
|
|
414
|
+
|
|
415
|
+
#### Parameters
|
|
416
|
+
|
|
417
|
+
##### plugin
|
|
418
|
+
|
|
419
|
+
`any`
|
|
420
|
+
|
|
421
|
+
The unified plugin function.
|
|
422
|
+
|
|
423
|
+
##### options
|
|
424
|
+
|
|
425
|
+
...`any`[]
|
|
426
|
+
|
|
427
|
+
Arguments for the plugin.
|
|
428
|
+
|
|
429
|
+
#### Returns
|
|
430
|
+
|
|
431
|
+
`this`
|
|
432
|
+
|
|
433
|
+
The pipeline instance for chaining.
|
|
434
|
+
|
|
435
|
+
#### Inherited from
|
|
436
|
+
|
|
437
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`use`](MdastBasePipeline.md#use)
|
|
438
|
+
|
|
439
|
+
***
|
|
440
|
+
|
|
441
|
+
### useAt()
|
|
442
|
+
|
|
443
|
+
> **useAt**(`stage`, `plugin`, ...`options`): `this`
|
|
444
|
+
|
|
445
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:226](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L226)
|
|
446
|
+
|
|
447
|
+
Adds a plugin to the pipeline at a specific stage.
|
|
448
|
+
|
|
449
|
+
#### Parameters
|
|
450
|
+
|
|
451
|
+
##### stage
|
|
452
|
+
|
|
453
|
+
The stage name or numeric value.
|
|
454
|
+
|
|
455
|
+
`"parse"` | `"normalize"` | `"compile"` | `"finalize"` | `"stringify"`
|
|
456
|
+
|
|
457
|
+
##### plugin
|
|
458
|
+
|
|
459
|
+
`any`
|
|
460
|
+
|
|
461
|
+
The unified plugin function.
|
|
462
|
+
|
|
463
|
+
##### options
|
|
464
|
+
|
|
465
|
+
...`any`[]
|
|
466
|
+
|
|
467
|
+
Arguments for the plugin.
|
|
468
|
+
|
|
469
|
+
#### Returns
|
|
470
|
+
|
|
471
|
+
`this`
|
|
472
|
+
|
|
473
|
+
The pipeline instance for chaining.
|
|
474
|
+
|
|
475
|
+
#### Inherited from
|
|
476
|
+
|
|
477
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`useAt`](MdastBasePipeline.md#useat)
|
|
478
|
+
|
|
479
|
+
***
|
|
480
|
+
|
|
481
|
+
### getFormat()
|
|
482
|
+
|
|
483
|
+
> `static` **getFormat**(`id`): `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
484
|
+
|
|
485
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:42](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L42)
|
|
486
|
+
|
|
487
|
+
Retrieves a registered format by its ID.
|
|
488
|
+
|
|
489
|
+
#### Parameters
|
|
490
|
+
|
|
491
|
+
##### id
|
|
492
|
+
|
|
493
|
+
`string`
|
|
494
|
+
|
|
495
|
+
The format identifier.
|
|
496
|
+
|
|
497
|
+
#### Returns
|
|
498
|
+
|
|
499
|
+
`undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
500
|
+
|
|
501
|
+
The format definition or undefined if not found.
|
|
502
|
+
|
|
503
|
+
#### Inherited from
|
|
504
|
+
|
|
505
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`getFormat`](MdastBasePipeline.md#getformat-2)
|
|
506
|
+
|
|
507
|
+
***
|
|
508
|
+
|
|
509
|
+
### register()
|
|
510
|
+
|
|
511
|
+
> `static` **register**(`format`): `void`
|
|
512
|
+
|
|
513
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:33](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L33)
|
|
514
|
+
|
|
515
|
+
Registers a global document format.
|
|
516
|
+
|
|
517
|
+
#### Parameters
|
|
518
|
+
|
|
519
|
+
##### format
|
|
520
|
+
|
|
521
|
+
[`MdastFormat`](../interfaces/MdastFormat.md)
|
|
522
|
+
|
|
523
|
+
The format definition to register.
|
|
524
|
+
|
|
525
|
+
#### Returns
|
|
526
|
+
|
|
527
|
+
`void`
|
|
528
|
+
|
|
529
|
+
#### Inherited from
|
|
530
|
+
|
|
531
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`register`](MdastBasePipeline.md#register)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[**@isdk/mdast-plus**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/mdast-plus](../globals.md) / PipelineStage
|
|
6
|
+
|
|
7
|
+
# Enumeration: PipelineStage
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/mdast-plus/src/types.ts:10](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L10)
|
|
10
|
+
|
|
11
|
+
PipelineStage defines the execution order of plugins in the processing pipeline.
|
|
12
|
+
Plugins are sorted and executed in ascending order based on these stage values.
|
|
13
|
+
|
|
14
|
+
## Enumeration Members
|
|
15
|
+
|
|
16
|
+
### compile
|
|
17
|
+
|
|
18
|
+
> **compile**: `200`
|
|
19
|
+
|
|
20
|
+
Defined in: [packages/mdast-plus/src/types.ts:16](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L16)
|
|
21
|
+
|
|
22
|
+
Transformation stage for semantic changes and custom high-level logic.
|
|
23
|
+
|
|
24
|
+
***
|
|
25
|
+
|
|
26
|
+
### finalize
|
|
27
|
+
|
|
28
|
+
> **finalize**: `300`
|
|
29
|
+
|
|
30
|
+
Defined in: [packages/mdast-plus/src/types.ts:18](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L18)
|
|
31
|
+
|
|
32
|
+
Finalization stage for preparing the AST for output (e.g., Sanitize, bridge to HAST).
|
|
33
|
+
|
|
34
|
+
***
|
|
35
|
+
|
|
36
|
+
### normalize
|
|
37
|
+
|
|
38
|
+
> **normalize**: `100`
|
|
39
|
+
|
|
40
|
+
Defined in: [packages/mdast-plus/src/types.ts:14](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L14)
|
|
41
|
+
|
|
42
|
+
Normalization stage for cleaning up and canonicalizing the AST (e.g., GFM, Directives).
|
|
43
|
+
|
|
44
|
+
***
|
|
45
|
+
|
|
46
|
+
### parse
|
|
47
|
+
|
|
48
|
+
> **parse**: `0`
|
|
49
|
+
|
|
50
|
+
Defined in: [packages/mdast-plus/src/types.ts:12](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L12)
|
|
51
|
+
|
|
52
|
+
Initial stage for parsing raw input (e.g., string to AST).
|
|
53
|
+
|
|
54
|
+
***
|
|
55
|
+
|
|
56
|
+
### stringify
|
|
57
|
+
|
|
58
|
+
> **stringify**: `400`
|
|
59
|
+
|
|
60
|
+
Defined in: [packages/mdast-plus/src/types.ts:20](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L20)
|
|
61
|
+
|
|
62
|
+
Final stage for serializing the AST to the target format result.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@isdk/mdast-plus**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/mdast-plus](../globals.md) / astCompiler
|
|
6
|
+
|
|
7
|
+
# Function: astCompiler()
|
|
8
|
+
|
|
9
|
+
> **astCompiler**(`this`): `void`
|
|
10
|
+
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/ast.ts:16](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/formats/ast.ts#L16)
|
|
12
|
+
|
|
13
|
+
Pass-through compiler that returns the AST as-is.
|
|
14
|
+
Essential for unified processes that should output an object (the AST)
|
|
15
|
+
instead of a serialized string.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
### this
|
|
20
|
+
|
|
21
|
+
`any`
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`void`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[**@isdk/mdast-plus**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/mdast-plus](../globals.md) / jsonParser
|
|
6
|
+
|
|
7
|
+
# Function: jsonParser()
|
|
8
|
+
|
|
9
|
+
> **jsonParser**(`this`): `void`
|
|
10
|
+
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/ast.ts:24](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/formats/ast.ts#L24)
|
|
12
|
+
|
|
13
|
+
Parser for stringified JSON AST input.
|
|
14
|
+
Allows the pipeline to accept a JSON string and treat it as a unist tree.
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
### this
|
|
19
|
+
|
|
20
|
+
`any`
|
|
21
|
+
|
|
22
|
+
## Returns
|
|
23
|
+
|
|
24
|
+
`void`
|
package/docs/functions/mdast.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: mdast()
|
|
8
8
|
|
|
9
|
-
> **mdast**(`input`): [`
|
|
9
|
+
> **mdast**(`input`): [`MdastPipeline`](../classes/MdastPipeline.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
11
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:362](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L362)
|
|
12
12
|
|
|
13
13
|
Entry point for the fluent mdast-plus API.
|
|
14
14
|
|
|
@@ -16,12 +16,12 @@ Entry point for the fluent mdast-plus API.
|
|
|
16
16
|
|
|
17
17
|
### input
|
|
18
18
|
|
|
19
|
-
`
|
|
19
|
+
`Compatible`
|
|
20
20
|
|
|
21
21
|
The input content (string or mdast tree)
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
|
-
[`
|
|
25
|
+
[`MdastPipeline`](../classes/MdastPipeline.md)
|
|
26
26
|
|
|
27
27
|
A FluentProcessor instance
|
package/docs/globals.md
CHANGED
|
@@ -4,35 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
# @isdk/mdast-plus
|
|
6
6
|
|
|
7
|
+
## Enumerations
|
|
8
|
+
|
|
9
|
+
- [PipelineStage](enumerations/PipelineStage.md)
|
|
10
|
+
|
|
7
11
|
## Classes
|
|
8
12
|
|
|
9
|
-
- [
|
|
13
|
+
- [MdastBasePipeline](classes/MdastBasePipeline.md)
|
|
14
|
+
- [MdastPipeline](classes/MdastPipeline.md)
|
|
10
15
|
|
|
11
16
|
## Interfaces
|
|
12
17
|
|
|
13
|
-
- [ConvertResult](interfaces/ConvertResult.md)
|
|
14
|
-
- [MdastAsset](interfaces/MdastAsset.md)
|
|
15
18
|
- [MdastDataOrigin](interfaces/MdastDataOrigin.md)
|
|
16
|
-
- [
|
|
19
|
+
- [MdastFormat](interfaces/MdastFormat.md)
|
|
17
20
|
- [MdastMark](interfaces/MdastMark.md)
|
|
18
21
|
- [MdastPlugin](interfaces/MdastPlugin.md)
|
|
19
|
-
- [MdastReader](interfaces/MdastReader.md)
|
|
20
22
|
- [MdastSub](interfaces/MdastSub.md)
|
|
21
23
|
- [MdastSup](interfaces/MdastSup.md)
|
|
22
|
-
- [MdastTransformer](interfaces/MdastTransformer.md)
|
|
23
|
-
- [MdastWriter](interfaces/MdastWriter.md)
|
|
24
24
|
|
|
25
25
|
## Type Aliases
|
|
26
26
|
|
|
27
|
-
- [
|
|
27
|
+
- [PipelineStageName](type-aliases/PipelineStageName.md)
|
|
28
28
|
|
|
29
29
|
## Variables
|
|
30
30
|
|
|
31
|
+
- [astFormat](variables/astFormat.md)
|
|
32
|
+
- [DefaultPipelineStage](variables/DefaultPipelineStage.md)
|
|
31
33
|
- [htmlFormat](variables/htmlFormat.md)
|
|
32
34
|
- [markdownFormat](variables/markdownFormat.md)
|
|
33
35
|
|
|
34
36
|
## Functions
|
|
35
37
|
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
+
- [astCompiler](functions/astCompiler.md)
|
|
39
|
+
- [jsonParser](functions/jsonParser.md)
|
|
38
40
|
- [mdast](functions/mdast.md)
|