@isdk/mdast-plus 0.1.3 → 0.2.1
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 +24 -9
- package/README.md +19 -4
- package/dist/index.d.mts +409 -85
- package/dist/index.d.ts +409 -85
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +19 -4
- package/docs/_media/CONTRIBUTING.md +23 -13
- package/docs/_media/README.cn.md +24 -9
- package/docs/classes/MdastBasePipeline.md +129 -29
- package/docs/classes/MdastPipeline.md +155 -39
- package/docs/enumerations/PipelineStage.md +6 -6
- package/docs/functions/astCompiler.md +1 -1
- package/docs/functions/jsonParser.md +1 -1
- package/docs/functions/mdast.md +1 -1
- package/docs/globals.md +5 -0
- package/docs/interfaces/MdastDataOrigin.md +4 -4
- package/docs/interfaces/MdastFormat.md +7 -7
- package/docs/interfaces/MdastMark.md +3 -3
- package/docs/interfaces/MdastPlugin.md +38 -6
- package/docs/interfaces/MdastSub.md +3 -3
- package/docs/interfaces/MdastSup.md +3 -3
- package/docs/interfaces/ReadabilityOptions.md +41 -0
- package/docs/type-aliases/PipelineStageName.md +1 -1
- package/docs/variables/DefaultPipelineStage.md +1 -1
- package/docs/variables/astFormat.md +1 -1
- package/docs/variables/htmlFormat.md +1 -1
- package/docs/variables/htmlReadability.md +13 -0
- package/docs/variables/htmlReadabilityPlugin.md +31 -0
- package/docs/variables/htmlReadabilityPlugins.md +13 -0
- package/docs/variables/markdownFormat.md +1 -1
- package/docs/variables/restoreReadabilityMetaPlugin.md +49 -0
- package/package.json +8 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: MdastPipeline
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
9
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:426](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L426)
|
|
10
10
|
|
|
11
11
|
Extended pipeline with convenience methods for common formats.
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ Extended pipeline with convenience methods for common formats.
|
|
|
20
20
|
|
|
21
21
|
> **new MdastPipeline**(`input`): `MdastPipeline`
|
|
22
22
|
|
|
23
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
23
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:54](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L54)
|
|
24
24
|
|
|
25
25
|
Initializes a new pipeline instance with the given input.
|
|
26
26
|
|
|
@@ -42,11 +42,23 @@ Content to process (string, Buffer, VFile, or AST Node).
|
|
|
42
42
|
|
|
43
43
|
## Properties
|
|
44
44
|
|
|
45
|
+
### \_data
|
|
46
|
+
|
|
47
|
+
> `protected` **\_data**: `Record`\<`string`, `any`\> = `{}`
|
|
48
|
+
|
|
49
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:48](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L48)
|
|
50
|
+
|
|
51
|
+
#### Inherited from
|
|
52
|
+
|
|
53
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`_data`](MdastBasePipeline.md#_data)
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
45
57
|
### input
|
|
46
58
|
|
|
47
59
|
> `protected` **input**: `Compatible`
|
|
48
60
|
|
|
49
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:46](https://github.com/isdk/mdast-plus.js/blob/
|
|
61
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:46](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L46)
|
|
50
62
|
|
|
51
63
|
#### Inherited from
|
|
52
64
|
|
|
@@ -58,7 +70,7 @@ Defined in: [packages/mdast-plus/src/pipeline.ts:46](https://github.com/isdk/mda
|
|
|
58
70
|
|
|
59
71
|
> `protected` **queue**: [`MdastPlugin`](../interfaces/MdastPlugin.md)[] = `[]`
|
|
60
72
|
|
|
61
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:47](https://github.com/isdk/mdast-plus.js/blob/
|
|
73
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:47](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L47)
|
|
62
74
|
|
|
63
75
|
#### Inherited from
|
|
64
76
|
|
|
@@ -70,7 +82,7 @@ Defined in: [packages/mdast-plus/src/pipeline.ts:47](https://github.com/isdk/mda
|
|
|
70
82
|
|
|
71
83
|
> `protected` **assembleProcessor**(`queue`): `Processor`
|
|
72
84
|
|
|
73
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
85
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:347](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L347)
|
|
74
86
|
|
|
75
87
|
Assembles a unified processor based on the sorted plugin queue.
|
|
76
88
|
|
|
@@ -90,11 +102,81 @@ Assembles a unified processor based on the sorted plugin queue.
|
|
|
90
102
|
|
|
91
103
|
***
|
|
92
104
|
|
|
105
|
+
### configure()
|
|
106
|
+
|
|
107
|
+
> **configure**(`pluginName`, ...`options`): `this`
|
|
108
|
+
|
|
109
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:331](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L331)
|
|
110
|
+
|
|
111
|
+
Modifies the options of a plugin that is already in the pipeline queue.
|
|
112
|
+
Searches from the end of the queue and updates the first match found.
|
|
113
|
+
|
|
114
|
+
#### Parameters
|
|
115
|
+
|
|
116
|
+
##### pluginName
|
|
117
|
+
|
|
118
|
+
`string`
|
|
119
|
+
|
|
120
|
+
The name of the plugin to modify.
|
|
121
|
+
Matches against explicit plugin name or function name.
|
|
122
|
+
|
|
123
|
+
##### options
|
|
124
|
+
|
|
125
|
+
...`any`[]
|
|
126
|
+
|
|
127
|
+
The new options to pass to the plugin (replaces existing options).
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`this`
|
|
132
|
+
|
|
133
|
+
The pipeline instance for chaining.
|
|
134
|
+
|
|
135
|
+
#### Inherited from
|
|
136
|
+
|
|
137
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`configure`](MdastBasePipeline.md#configure)
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
|
|
141
|
+
### data()
|
|
142
|
+
|
|
143
|
+
> **data**(`key`, `value?`): `this`
|
|
144
|
+
|
|
145
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:64](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L64)
|
|
146
|
+
|
|
147
|
+
Configures global data for the pipeline, which will be available to all plugins via this.data().
|
|
148
|
+
|
|
149
|
+
#### Parameters
|
|
150
|
+
|
|
151
|
+
##### key
|
|
152
|
+
|
|
153
|
+
Data key or a record of multiple data entries.
|
|
154
|
+
|
|
155
|
+
`string` | `Record`\<`string`, `any`\>
|
|
156
|
+
|
|
157
|
+
##### value?
|
|
158
|
+
|
|
159
|
+
`any`
|
|
160
|
+
|
|
161
|
+
Value to set (if key is a string).
|
|
162
|
+
|
|
163
|
+
#### Returns
|
|
164
|
+
|
|
165
|
+
`this`
|
|
166
|
+
|
|
167
|
+
The pipeline instance for chaining.
|
|
168
|
+
|
|
169
|
+
#### Inherited from
|
|
170
|
+
|
|
171
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`data`](MdastBasePipeline.md#data)
|
|
172
|
+
|
|
173
|
+
***
|
|
174
|
+
|
|
93
175
|
### ensureInputPlugins()
|
|
94
176
|
|
|
95
177
|
> `protected` **ensureInputPlugins**(`queue`, `overrides?`, `maxStage?`): `void`
|
|
96
178
|
|
|
97
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
179
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:149](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L149)
|
|
98
180
|
|
|
99
181
|
Ensures that input plugins (parser, normalizers) are present in the queue.
|
|
100
182
|
Adds implicit plugins if no parser is detected.
|
|
@@ -127,7 +209,7 @@ Adds implicit plugins if no parser is detected.
|
|
|
127
209
|
|
|
128
210
|
> **from**(`fmt`, `overrides?`): `this`
|
|
129
211
|
|
|
130
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
212
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:178](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L178)
|
|
131
213
|
|
|
132
214
|
Configures the input format and adds its associated plugins to the pipeline.
|
|
133
215
|
|
|
@@ -161,7 +243,7 @@ The pipeline instance for chaining.
|
|
|
161
243
|
|
|
162
244
|
> **getFormat**(`id`): `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
163
245
|
|
|
164
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
246
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:76](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L76)
|
|
165
247
|
|
|
166
248
|
Instance-level access to the global format registry.
|
|
167
249
|
|
|
@@ -185,7 +267,7 @@ Instance-level access to the global format registry.
|
|
|
185
267
|
|
|
186
268
|
> **priority**(`order`): `this`
|
|
187
269
|
|
|
188
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
270
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:314](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L314)
|
|
189
271
|
|
|
190
272
|
Sets the priority order for the most recently added plugin.
|
|
191
273
|
Plugins with lower order run earlier within the same stage.
|
|
@@ -214,7 +296,7 @@ The pipeline instance for chaining.
|
|
|
214
296
|
|
|
215
297
|
> **to**(`fmt`, `overrides?`): `Promise`\<`VFile`\>
|
|
216
298
|
|
|
217
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
299
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:198](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L198)
|
|
218
300
|
|
|
219
301
|
Processes the pipeline and serializes the result into the specified format.
|
|
220
302
|
|
|
@@ -248,7 +330,7 @@ A promise resolving to a VFile containing the result.
|
|
|
248
330
|
|
|
249
331
|
> **toAst**(`options?`): `Promise`\<`Root`\>
|
|
250
332
|
|
|
251
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
333
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:463](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L463)
|
|
252
334
|
|
|
253
335
|
Finalizes the pipeline and returns the resulting AST (Root node).
|
|
254
336
|
|
|
@@ -266,7 +348,7 @@ Map for plugin option overrides.
|
|
|
266
348
|
|
|
267
349
|
###### stage?
|
|
268
350
|
|
|
269
|
-
`"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
351
|
+
[`PipelineStage`](../enumerations/PipelineStage.md) \| `"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
270
352
|
|
|
271
353
|
Run the pipeline up to this stage only.
|
|
272
354
|
|
|
@@ -280,7 +362,7 @@ Run the pipeline up to this stage only.
|
|
|
280
362
|
|
|
281
363
|
> **toAST**(`options?`): `Promise`\<`Root`\>
|
|
282
364
|
|
|
283
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
365
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:501](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L501)
|
|
284
366
|
|
|
285
367
|
Alias for toAst()
|
|
286
368
|
|
|
@@ -294,7 +376,7 @@ Alias for toAst()
|
|
|
294
376
|
|
|
295
377
|
###### stage?
|
|
296
378
|
|
|
297
|
-
`"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
379
|
+
[`PipelineStage`](../enumerations/PipelineStage.md) \| `"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
298
380
|
|
|
299
381
|
#### Returns
|
|
300
382
|
|
|
@@ -306,7 +388,7 @@ Alias for toAst()
|
|
|
306
388
|
|
|
307
389
|
> **toHtml**(): `Promise`\<`string`\>
|
|
308
390
|
|
|
309
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
391
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:445](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L445)
|
|
310
392
|
|
|
311
393
|
Finalizes the pipeline and returns the result as an HTML string.
|
|
312
394
|
|
|
@@ -320,7 +402,7 @@ Finalizes the pipeline and returns the result as an HTML string.
|
|
|
320
402
|
|
|
321
403
|
> **toHTML**(): `Promise`\<`string`\>
|
|
322
404
|
|
|
323
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
405
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:499](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L499)
|
|
324
406
|
|
|
325
407
|
Alias for toHtml()
|
|
326
408
|
|
|
@@ -334,7 +416,7 @@ Alias for toHtml()
|
|
|
334
416
|
|
|
335
417
|
> **toHtmlVFile**(): `Promise`\<`VFile`\>
|
|
336
418
|
|
|
337
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
419
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:453](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L453)
|
|
338
420
|
|
|
339
421
|
Finalizes the pipeline and returns a VFile containing the HTML result.
|
|
340
422
|
|
|
@@ -348,7 +430,7 @@ Finalizes the pipeline and returns a VFile containing the HTML result.
|
|
|
348
430
|
|
|
349
431
|
> **toMarkdown**(): `Promise`\<`string`\>
|
|
350
432
|
|
|
351
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
433
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:430](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L430)
|
|
352
434
|
|
|
353
435
|
Finalizes the pipeline and returns the result as a Markdown string.
|
|
354
436
|
|
|
@@ -362,7 +444,7 @@ Finalizes the pipeline and returns the result as a Markdown string.
|
|
|
362
444
|
|
|
363
445
|
> **toMarkdownVFile**(): `Promise`\<`VFile`\>
|
|
364
446
|
|
|
365
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
447
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:438](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L438)
|
|
366
448
|
|
|
367
449
|
Finalizes the pipeline and returns a VFile containing the Markdown result.
|
|
368
450
|
|
|
@@ -376,7 +458,7 @@ Finalizes the pipeline and returns a VFile containing the Markdown result.
|
|
|
376
458
|
|
|
377
459
|
> `protected` **toRuntimeEntry**(`entry`, `defaultStage`, `overrides?`): [`MdastPlugin`](../interfaces/MdastPlugin.md) & `object`
|
|
378
460
|
|
|
379
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
461
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:100](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L100)
|
|
380
462
|
|
|
381
463
|
Normalizes a plugin entry for runtime execution.
|
|
382
464
|
|
|
@@ -408,23 +490,23 @@ Normalizes a plugin entry for runtime execution.
|
|
|
408
490
|
|
|
409
491
|
> **use**(`plugin`, ...`options`): `this`
|
|
410
492
|
|
|
411
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
493
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:241](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L241)
|
|
412
494
|
|
|
413
|
-
Adds a plugin to the pipeline's compile stage.
|
|
495
|
+
Adds a plugin or an array of plugins to the pipeline's compile stage.
|
|
414
496
|
|
|
415
497
|
#### Parameters
|
|
416
498
|
|
|
417
499
|
##### plugin
|
|
418
500
|
|
|
419
|
-
|
|
501
|
+
The unified plugin function, a MdastPlugin object, or an array of them.
|
|
420
502
|
|
|
421
|
-
|
|
503
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md) | `Plugin` | ([`MdastPlugin`](../interfaces/MdastPlugin.md) \| `Plugin`)[]
|
|
422
504
|
|
|
423
505
|
##### options
|
|
424
506
|
|
|
425
507
|
...`any`[]
|
|
426
508
|
|
|
427
|
-
Arguments for the plugin.
|
|
509
|
+
Arguments for the plugin(s).
|
|
428
510
|
|
|
429
511
|
#### Returns
|
|
430
512
|
|
|
@@ -440,39 +522,73 @@ The pipeline instance for chaining.
|
|
|
440
522
|
|
|
441
523
|
### useAt()
|
|
442
524
|
|
|
525
|
+
#### Call Signature
|
|
526
|
+
|
|
443
527
|
> **useAt**(`stage`, `plugin`, ...`options`): `this`
|
|
444
528
|
|
|
445
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:
|
|
529
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:252](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L252)
|
|
446
530
|
|
|
447
|
-
Adds a plugin to the pipeline at a specific stage.
|
|
531
|
+
Adds a plugin or an array of plugins to the pipeline at a specific stage.
|
|
448
532
|
|
|
449
|
-
|
|
533
|
+
##### Parameters
|
|
450
534
|
|
|
451
|
-
|
|
535
|
+
###### stage
|
|
452
536
|
|
|
453
537
|
The stage name or numeric value.
|
|
454
538
|
|
|
455
|
-
`"parse"` | `"normalize"` | `"compile"` | `"finalize"` | `"stringify"`
|
|
539
|
+
[`PipelineStage`](../enumerations/PipelineStage.md) | `"parse"` | `"normalize"` | `"compile"` | `"finalize"` | `"stringify"`
|
|
456
540
|
|
|
457
|
-
|
|
541
|
+
###### plugin
|
|
458
542
|
|
|
459
|
-
|
|
543
|
+
The unified plugin function, a MdastPlugin object, or an array of them.
|
|
460
544
|
|
|
461
|
-
|
|
545
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md) | `Plugin` | ([`MdastPlugin`](../interfaces/MdastPlugin.md) \| `Plugin`)[]
|
|
462
546
|
|
|
463
|
-
|
|
547
|
+
###### options
|
|
464
548
|
|
|
465
549
|
...`any`[]
|
|
466
550
|
|
|
467
|
-
Arguments for the plugin.
|
|
551
|
+
Arguments for the plugin(s).
|
|
468
552
|
|
|
469
|
-
|
|
553
|
+
##### Returns
|
|
470
554
|
|
|
471
555
|
`this`
|
|
472
556
|
|
|
473
557
|
The pipeline instance for chaining.
|
|
474
558
|
|
|
475
|
-
|
|
559
|
+
##### Inherited from
|
|
560
|
+
|
|
561
|
+
[`MdastBasePipeline`](MdastBasePipeline.md).[`useAt`](MdastBasePipeline.md#useat)
|
|
562
|
+
|
|
563
|
+
#### Call Signature
|
|
564
|
+
|
|
565
|
+
> **useAt**(`plugin`, ...`options`): `this`
|
|
566
|
+
|
|
567
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:259](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L259)
|
|
568
|
+
|
|
569
|
+
Adds a plugin or an array of plugins to the pipeline. The stage is taken from the plugin object(s).
|
|
570
|
+
|
|
571
|
+
##### Parameters
|
|
572
|
+
|
|
573
|
+
###### plugin
|
|
574
|
+
|
|
575
|
+
The MdastPlugin object or an array of them.
|
|
576
|
+
|
|
577
|
+
[`MdastPlugin`](../interfaces/MdastPlugin.md) | [`MdastPlugin`](../interfaces/MdastPlugin.md)[]
|
|
578
|
+
|
|
579
|
+
###### options
|
|
580
|
+
|
|
581
|
+
...`any`[]
|
|
582
|
+
|
|
583
|
+
Arguments for the plugin(s) (overrides plugin.options if provided).
|
|
584
|
+
|
|
585
|
+
##### Returns
|
|
586
|
+
|
|
587
|
+
`this`
|
|
588
|
+
|
|
589
|
+
The pipeline instance for chaining.
|
|
590
|
+
|
|
591
|
+
##### Inherited from
|
|
476
592
|
|
|
477
593
|
[`MdastBasePipeline`](MdastBasePipeline.md).[`useAt`](MdastBasePipeline.md#useat)
|
|
478
594
|
|
|
@@ -482,7 +598,7 @@ The pipeline instance for chaining.
|
|
|
482
598
|
|
|
483
599
|
> `static` **getFormat**(`id`): `undefined` \| [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
484
600
|
|
|
485
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:42](https://github.com/isdk/mdast-plus.js/blob/
|
|
601
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:42](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L42)
|
|
486
602
|
|
|
487
603
|
Retrieves a registered format by its ID.
|
|
488
604
|
|
|
@@ -510,7 +626,7 @@ The format definition or undefined if not found.
|
|
|
510
626
|
|
|
511
627
|
> `static` **register**(`format`): `void`
|
|
512
628
|
|
|
513
|
-
Defined in: [packages/mdast-plus/src/pipeline.ts:33](https://github.com/isdk/mdast-plus.js/blob/
|
|
629
|
+
Defined in: [packages/mdast-plus/src/pipeline.ts:33](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L33)
|
|
514
630
|
|
|
515
631
|
Registers a global document format.
|
|
516
632
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Enumeration: PipelineStage
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/types.ts:10](https://github.com/isdk/mdast-plus.js/blob/
|
|
9
|
+
Defined in: [packages/mdast-plus/src/types.ts:10](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L10)
|
|
10
10
|
|
|
11
11
|
PipelineStage defines the execution order of plugins in the processing pipeline.
|
|
12
12
|
Plugins are sorted and executed in ascending order based on these stage values.
|
|
@@ -17,7 +17,7 @@ Plugins are sorted and executed in ascending order based on these stage values.
|
|
|
17
17
|
|
|
18
18
|
> **compile**: `200`
|
|
19
19
|
|
|
20
|
-
Defined in: [packages/mdast-plus/src/types.ts:16](https://github.com/isdk/mdast-plus.js/blob/
|
|
20
|
+
Defined in: [packages/mdast-plus/src/types.ts:16](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L16)
|
|
21
21
|
|
|
22
22
|
Transformation stage for semantic changes and custom high-level logic.
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ Transformation stage for semantic changes and custom high-level logic.
|
|
|
27
27
|
|
|
28
28
|
> **finalize**: `300`
|
|
29
29
|
|
|
30
|
-
Defined in: [packages/mdast-plus/src/types.ts:18](https://github.com/isdk/mdast-plus.js/blob/
|
|
30
|
+
Defined in: [packages/mdast-plus/src/types.ts:18](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L18)
|
|
31
31
|
|
|
32
32
|
Finalization stage for preparing the AST for output (e.g., Sanitize, bridge to HAST).
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ Finalization stage for preparing the AST for output (e.g., Sanitize, bridge to H
|
|
|
37
37
|
|
|
38
38
|
> **normalize**: `100`
|
|
39
39
|
|
|
40
|
-
Defined in: [packages/mdast-plus/src/types.ts:14](https://github.com/isdk/mdast-plus.js/blob/
|
|
40
|
+
Defined in: [packages/mdast-plus/src/types.ts:14](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L14)
|
|
41
41
|
|
|
42
42
|
Normalization stage for cleaning up and canonicalizing the AST (e.g., GFM, Directives).
|
|
43
43
|
|
|
@@ -47,7 +47,7 @@ Normalization stage for cleaning up and canonicalizing the AST (e.g., GFM, Direc
|
|
|
47
47
|
|
|
48
48
|
> **parse**: `0`
|
|
49
49
|
|
|
50
|
-
Defined in: [packages/mdast-plus/src/types.ts:12](https://github.com/isdk/mdast-plus.js/blob/
|
|
50
|
+
Defined in: [packages/mdast-plus/src/types.ts:12](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L12)
|
|
51
51
|
|
|
52
52
|
Initial stage for parsing raw input (e.g., string to AST).
|
|
53
53
|
|
|
@@ -57,6 +57,6 @@ Initial stage for parsing raw input (e.g., string to AST).
|
|
|
57
57
|
|
|
58
58
|
> **stringify**: `400`
|
|
59
59
|
|
|
60
|
-
Defined in: [packages/mdast-plus/src/types.ts:20](https://github.com/isdk/mdast-plus.js/blob/
|
|
60
|
+
Defined in: [packages/mdast-plus/src/types.ts:20](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L20)
|
|
61
61
|
|
|
62
62
|
Final stage for serializing the AST to the target format result.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **astCompiler**(`this`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/formats/ast.ts:16](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/ast.ts:16](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/formats/ast.ts#L16)
|
|
12
12
|
|
|
13
13
|
Pass-through compiler that returns the AST as-is.
|
|
14
14
|
Essential for unified processes that should output an object (the AST)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **jsonParser**(`this`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/formats/ast.ts:24](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/ast.ts:24](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/formats/ast.ts#L24)
|
|
12
12
|
|
|
13
13
|
Parser for stringified JSON AST input.
|
|
14
14
|
Allows the pipeline to accept a JSON string and treat it as a unist tree.
|
package/docs/functions/mdast.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
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:513](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/pipeline.ts#L513)
|
|
12
12
|
|
|
13
13
|
Entry point for the fluent mdast-plus API.
|
|
14
14
|
|
package/docs/globals.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- [MdastPlugin](interfaces/MdastPlugin.md)
|
|
22
22
|
- [MdastSub](interfaces/MdastSub.md)
|
|
23
23
|
- [MdastSup](interfaces/MdastSup.md)
|
|
24
|
+
- [ReadabilityOptions](interfaces/ReadabilityOptions.md)
|
|
24
25
|
|
|
25
26
|
## Type Aliases
|
|
26
27
|
|
|
@@ -31,7 +32,11 @@
|
|
|
31
32
|
- [astFormat](variables/astFormat.md)
|
|
32
33
|
- [DefaultPipelineStage](variables/DefaultPipelineStage.md)
|
|
33
34
|
- [htmlFormat](variables/htmlFormat.md)
|
|
35
|
+
- [htmlReadability](variables/htmlReadability.md)
|
|
36
|
+
- [htmlReadabilityPlugin](variables/htmlReadabilityPlugin.md)
|
|
37
|
+
- [htmlReadabilityPlugins](variables/htmlReadabilityPlugins.md)
|
|
34
38
|
- [markdownFormat](variables/markdownFormat.md)
|
|
39
|
+
- [restoreReadabilityMetaPlugin](variables/restoreReadabilityMetaPlugin.md)
|
|
35
40
|
|
|
36
41
|
## Functions
|
|
37
42
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: MdastDataOrigin
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
9
|
+
Defined in: [packages/mdast-plus/src/types.ts:86](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L86)
|
|
10
10
|
|
|
11
11
|
Metadata capturing the origin of a node during conversion.
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ Metadata capturing the origin of a node during conversion.
|
|
|
20
20
|
|
|
21
21
|
> **format**: `string`
|
|
22
22
|
|
|
23
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
23
|
+
Defined in: [packages/mdast-plus/src/types.ts:88](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L88)
|
|
24
24
|
|
|
25
25
|
The original source format.
|
|
26
26
|
|
|
@@ -30,7 +30,7 @@ The original source format.
|
|
|
30
30
|
|
|
31
31
|
> `optional` **hash**: `string`
|
|
32
32
|
|
|
33
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
33
|
+
Defined in: [packages/mdast-plus/src/types.ts:92](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L92)
|
|
34
34
|
|
|
35
35
|
Hash used for caching or change detection.
|
|
36
36
|
|
|
@@ -40,6 +40,6 @@ Hash used for caching or change detection.
|
|
|
40
40
|
|
|
41
41
|
> `optional` **raw**: `unknown`
|
|
42
42
|
|
|
43
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
43
|
+
Defined in: [packages/mdast-plus/src/types.ts:90](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L90)
|
|
44
44
|
|
|
45
45
|
The raw content from the source before conversion.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: MdastFormat
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
9
|
+
Defined in: [packages/mdast-plus/src/types.ts:66](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L66)
|
|
10
10
|
|
|
11
11
|
Defines a document format, encompassing its input (parsing) and output (serialization) strategies.
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Defines a document format, encompassing its input (parsing) and output (serializ
|
|
|
16
16
|
|
|
17
17
|
> `optional` **extensions**: `string`[]
|
|
18
18
|
|
|
19
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
19
|
+
Defined in: [packages/mdast-plus/src/types.ts:72](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L72)
|
|
20
20
|
|
|
21
21
|
File extensions associated with this format.
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ File extensions associated with this format.
|
|
|
26
26
|
|
|
27
27
|
> **id**: `string`
|
|
28
28
|
|
|
29
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
29
|
+
Defined in: [packages/mdast-plus/src/types.ts:68](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L68)
|
|
30
30
|
|
|
31
31
|
Unique identifier for the format (e.g., 'markdown', 'html').
|
|
32
32
|
|
|
@@ -36,7 +36,7 @@ Unique identifier for the format (e.g., 'markdown', 'html').
|
|
|
36
36
|
|
|
37
37
|
> `optional` **input**: [`MdastPlugin`](MdastPlugin.md)[]
|
|
38
38
|
|
|
39
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
39
|
+
Defined in: [packages/mdast-plus/src/types.ts:77](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L77)
|
|
40
40
|
|
|
41
41
|
Plugins used for reading this format into a standard AST (Parser + Normalizer).
|
|
42
42
|
|
|
@@ -46,7 +46,7 @@ Plugins used for reading this format into a standard AST (Parser + Normalizer).
|
|
|
46
46
|
|
|
47
47
|
> `optional` **mediaTypes**: `string`[]
|
|
48
48
|
|
|
49
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
49
|
+
Defined in: [packages/mdast-plus/src/types.ts:74](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L74)
|
|
50
50
|
|
|
51
51
|
MIME types associated with this format.
|
|
52
52
|
|
|
@@ -56,7 +56,7 @@ MIME types associated with this format.
|
|
|
56
56
|
|
|
57
57
|
> `optional` **output**: [`MdastPlugin`](MdastPlugin.md)[]
|
|
58
58
|
|
|
59
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
59
|
+
Defined in: [packages/mdast-plus/src/types.ts:80](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L80)
|
|
60
60
|
|
|
61
61
|
Plugins used for serializing the AST into this format (Finalizer + Stringifier).
|
|
62
62
|
|
|
@@ -66,6 +66,6 @@ Plugins used for serializing the AST into this format (Finalizer + Stringifier).
|
|
|
66
66
|
|
|
67
67
|
> `optional` **title**: `string`
|
|
68
68
|
|
|
69
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
69
|
+
Defined in: [packages/mdast-plus/src/types.ts:70](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L70)
|
|
70
70
|
|
|
71
71
|
Human-readable title.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: MdastMark
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
9
|
+
Defined in: [packages/mdast-plus/src/types.ts:97](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L97)
|
|
10
10
|
|
|
11
11
|
Represents a highlighted text (mark) node in mdast.
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ Represents a highlighted text (mark) node in mdast.
|
|
|
20
20
|
|
|
21
21
|
> **children**: `PhrasingContent`[]
|
|
22
22
|
|
|
23
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
23
|
+
Defined in: [packages/mdast-plus/src/types.ts:99](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L99)
|
|
24
24
|
|
|
25
25
|
List of children.
|
|
26
26
|
|
|
@@ -65,7 +65,7 @@ have a position.
|
|
|
65
65
|
|
|
66
66
|
> **type**: `"mark"`
|
|
67
67
|
|
|
68
|
-
Defined in: [packages/mdast-plus/src/types.ts:
|
|
68
|
+
Defined in: [packages/mdast-plus/src/types.ts:98](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L98)
|
|
69
69
|
|
|
70
70
|
Node type.
|
|
71
71
|
|