@isdk/mdast-plus 0.1.1 → 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.
Files changed (38) hide show
  1. package/README.cn.md +62 -19
  2. package/README.md +62 -19
  3. package/dist/index.d.mts +192 -125
  4. package/dist/index.d.ts +192 -125
  5. package/dist/index.js +1 -1
  6. package/dist/index.mjs +1 -1
  7. package/docs/README.md +62 -19
  8. package/docs/_media/CONTRIBUTING.md +39 -18
  9. package/docs/_media/README.cn.md +62 -19
  10. package/docs/classes/MdastBasePipeline.md +348 -0
  11. package/docs/classes/MdastPipeline.md +531 -0
  12. package/docs/enumerations/PipelineStage.md +62 -0
  13. package/docs/functions/astCompiler.md +25 -0
  14. package/docs/functions/jsonParser.md +24 -0
  15. package/docs/functions/mdast.md +4 -4
  16. package/docs/globals.md +17 -10
  17. package/docs/interfaces/MdastDataOrigin.md +8 -8
  18. package/docs/interfaces/MdastFormat.md +71 -0
  19. package/docs/interfaces/MdastMark.md +4 -4
  20. package/docs/interfaces/MdastPlugin.md +27 -27
  21. package/docs/interfaces/MdastSub.md +4 -4
  22. package/docs/interfaces/MdastSup.md +4 -4
  23. package/docs/type-aliases/PipelineStageName.md +13 -0
  24. package/docs/variables/DefaultPipelineStage.md +13 -0
  25. package/docs/variables/astFormat.md +15 -0
  26. package/docs/variables/htmlFormat.md +16 -0
  27. package/docs/variables/markdownFormat.md +16 -0
  28. package/package.json +11 -9
  29. package/docs/classes/FluentProcessor.md +0 -194
  30. package/docs/functions/htmlFormat.md +0 -24
  31. package/docs/functions/markdownFormat.md +0 -24
  32. package/docs/interfaces/ConvertResult.md +0 -39
  33. package/docs/interfaces/MdastAsset.md +0 -41
  34. package/docs/interfaces/MdastFormatDefinition.md +0 -51
  35. package/docs/interfaces/MdastReader.md +0 -41
  36. package/docs/interfaces/MdastTransformer.md +0 -33
  37. package/docs/interfaces/MdastWriter.md +0 -47
  38. package/docs/type-aliases/Stage.md +0 -13
@@ -0,0 +1,348 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / MdastBasePipeline
6
+
7
+ # Class: MdastBasePipeline
8
+
9
+ Defined in: [packages/mdast-plus/src/pipeline.ts:26](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L26)
10
+
11
+ Base implementation of the fluent mdast processing pipeline.
12
+ Manages the plugin registry and the execution queue.
13
+
14
+ ## Extended by
15
+
16
+ - [`MdastPipeline`](MdastPipeline.md)
17
+
18
+ ## Constructors
19
+
20
+ ### Constructor
21
+
22
+ > **new MdastBasePipeline**(`input`): `MdastBasePipeline`
23
+
24
+ Defined in: [packages/mdast-plus/src/pipeline.ts:53](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L53)
25
+
26
+ Initializes a new pipeline instance with the given input.
27
+
28
+ #### Parameters
29
+
30
+ ##### input
31
+
32
+ `Compatible`
33
+
34
+ Content to process (string, Buffer, VFile, or AST Node).
35
+
36
+ #### Returns
37
+
38
+ `MdastBasePipeline`
39
+
40
+ ## Properties
41
+
42
+ ### input
43
+
44
+ > `protected` **input**: `Compatible`
45
+
46
+ Defined in: [packages/mdast-plus/src/pipeline.ts:46](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L46)
47
+
48
+ ***
49
+
50
+ ### queue
51
+
52
+ > `protected` **queue**: [`MdastPlugin`](../interfaces/MdastPlugin.md)[] = `[]`
53
+
54
+ Defined in: [packages/mdast-plus/src/pipeline.ts:47](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L47)
55
+
56
+ ## Methods
57
+
58
+ ### assembleProcessor()
59
+
60
+ > `protected` **assembleProcessor**(`queue`): `Processor`
61
+
62
+ Defined in: [packages/mdast-plus/src/pipeline.ts:254](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L254)
63
+
64
+ Assembles a unified processor based on the sorted plugin queue.
65
+
66
+ #### Parameters
67
+
68
+ ##### queue
69
+
70
+ [`MdastPlugin`](../interfaces/MdastPlugin.md)[]
71
+
72
+ #### Returns
73
+
74
+ `Processor`
75
+
76
+ ***
77
+
78
+ ### ensureInputPlugins()
79
+
80
+ > `protected` **ensureInputPlugins**(`queue`, `overrides?`, `maxStage?`): `void`
81
+
82
+ Defined in: [packages/mdast-plus/src/pipeline.ts:123](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L123)
83
+
84
+ Ensures that input plugins (parser, normalizers) are present in the queue.
85
+ Adds implicit plugins if no parser is detected.
86
+
87
+ #### Parameters
88
+
89
+ ##### queue
90
+
91
+ [`MdastPlugin`](../interfaces/MdastPlugin.md)[]
92
+
93
+ ##### overrides?
94
+
95
+ `Record`\<`string`, `any`\>
96
+
97
+ ##### maxStage?
98
+
99
+ [`PipelineStage`](../enumerations/PipelineStage.md) = `PipelineStage.stringify`
100
+
101
+ #### Returns
102
+
103
+ `void`
104
+
105
+ ***
106
+
107
+ ### from()
108
+
109
+ > **from**(`fmt`, `overrides?`): `this`
110
+
111
+ Defined in: [packages/mdast-plus/src/pipeline.ts:152](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L152)
112
+
113
+ Configures the input format and adds its associated plugins to the pipeline.
114
+
115
+ #### Parameters
116
+
117
+ ##### fmt
118
+
119
+ Format ID or definition.
120
+
121
+ `string` | [`MdastFormat`](../interfaces/MdastFormat.md)
122
+
123
+ ##### overrides?
124
+
125
+ `Record`\<`string`, `any`\>
126
+
127
+ Optional map to override plugin options by plugin name.
128
+
129
+ #### Returns
130
+
131
+ `this`
132
+
133
+ The pipeline instance for chaining.
134
+
135
+ ***
136
+
137
+ ### getFormat()
138
+
139
+ > **getFormat**(`id`): `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
140
+
141
+ Defined in: [packages/mdast-plus/src/pipeline.ts:60](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L60)
142
+
143
+ Instance-level access to the global format registry.
144
+
145
+ #### Parameters
146
+
147
+ ##### id
148
+
149
+ `string`
150
+
151
+ #### Returns
152
+
153
+ `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
154
+
155
+ ***
156
+
157
+ ### priority()
158
+
159
+ > **priority**(`order`): `this`
160
+
161
+ Defined in: [packages/mdast-plus/src/pipeline.ts:242](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L242)
162
+
163
+ Sets the priority order for the most recently added plugin.
164
+ Plugins with lower order run earlier within the same stage.
165
+
166
+ #### Parameters
167
+
168
+ ##### order
169
+
170
+ `number`
171
+
172
+ Numeric priority.
173
+
174
+ #### Returns
175
+
176
+ `this`
177
+
178
+ The pipeline instance for chaining.
179
+
180
+ ***
181
+
182
+ ### to()
183
+
184
+ > **to**(`fmt`, `overrides?`): `Promise`\<`VFile`\>
185
+
186
+ Defined in: [packages/mdast-plus/src/pipeline.ts:172](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L172)
187
+
188
+ Processes the pipeline and serializes the result into the specified format.
189
+
190
+ #### Parameters
191
+
192
+ ##### fmt
193
+
194
+ Target format ID or definition.
195
+
196
+ `string` | [`MdastFormat`](../interfaces/MdastFormat.md)
197
+
198
+ ##### overrides?
199
+
200
+ `Record`\<`string`, `any`\>
201
+
202
+ Optional map to override plugin options.
203
+
204
+ #### Returns
205
+
206
+ `Promise`\<`VFile`\>
207
+
208
+ A promise resolving to a VFile containing the result.
209
+
210
+ ***
211
+
212
+ ### toRuntimeEntry()
213
+
214
+ > `protected` **toRuntimeEntry**(`entry`, `defaultStage`, `overrides?`): [`MdastPlugin`](../interfaces/MdastPlugin.md) & `object`
215
+
216
+ Defined in: [packages/mdast-plus/src/pipeline.ts:84](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L84)
217
+
218
+ Normalizes a plugin entry for runtime execution.
219
+
220
+ #### Parameters
221
+
222
+ ##### entry
223
+
224
+ [`MdastPlugin`](../interfaces/MdastPlugin.md)
225
+
226
+ ##### defaultStage
227
+
228
+ [`PipelineStage`](../enumerations/PipelineStage.md)
229
+
230
+ ##### overrides?
231
+
232
+ `Record`\<`string`, `any`\>
233
+
234
+ #### Returns
235
+
236
+ [`MdastPlugin`](../interfaces/MdastPlugin.md) & `object`
237
+
238
+ ***
239
+
240
+ ### use()
241
+
242
+ > **use**(`plugin`, ...`options`): `this`
243
+
244
+ Defined in: [packages/mdast-plus/src/pipeline.ts:215](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L215)
245
+
246
+ Adds a plugin to the pipeline's compile stage.
247
+
248
+ #### Parameters
249
+
250
+ ##### plugin
251
+
252
+ `any`
253
+
254
+ The unified plugin function.
255
+
256
+ ##### options
257
+
258
+ ...`any`[]
259
+
260
+ Arguments for the plugin.
261
+
262
+ #### Returns
263
+
264
+ `this`
265
+
266
+ The pipeline instance for chaining.
267
+
268
+ ***
269
+
270
+ ### useAt()
271
+
272
+ > **useAt**(`stage`, `plugin`, ...`options`): `this`
273
+
274
+ Defined in: [packages/mdast-plus/src/pipeline.ts:226](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L226)
275
+
276
+ Adds a plugin to the pipeline at a specific stage.
277
+
278
+ #### Parameters
279
+
280
+ ##### stage
281
+
282
+ The stage name or numeric value.
283
+
284
+ `"parse"` | `"normalize"` | `"compile"` | `"finalize"` | `"stringify"`
285
+
286
+ ##### plugin
287
+
288
+ `any`
289
+
290
+ The unified plugin function.
291
+
292
+ ##### options
293
+
294
+ ...`any`[]
295
+
296
+ Arguments for the plugin.
297
+
298
+ #### Returns
299
+
300
+ `this`
301
+
302
+ The pipeline instance for chaining.
303
+
304
+ ***
305
+
306
+ ### getFormat()
307
+
308
+ > `static` **getFormat**(`id`): `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
309
+
310
+ Defined in: [packages/mdast-plus/src/pipeline.ts:42](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L42)
311
+
312
+ Retrieves a registered format by its ID.
313
+
314
+ #### Parameters
315
+
316
+ ##### id
317
+
318
+ `string`
319
+
320
+ The format identifier.
321
+
322
+ #### Returns
323
+
324
+ `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
325
+
326
+ The format definition or undefined if not found.
327
+
328
+ ***
329
+
330
+ ### register()
331
+
332
+ > `static` **register**(`format`): `void`
333
+
334
+ Defined in: [packages/mdast-plus/src/pipeline.ts:33](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/pipeline.ts#L33)
335
+
336
+ Registers a global document format.
337
+
338
+ #### Parameters
339
+
340
+ ##### format
341
+
342
+ [`MdastFormat`](../interfaces/MdastFormat.md)
343
+
344
+ The format definition to register.
345
+
346
+ #### Returns
347
+
348
+ `void`