@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/dist/index.d.mts CHANGED
@@ -22,7 +22,7 @@ import { VFileCompatible, VFile } from 'vfile';
22
22
  * }
23
23
  * ```
24
24
  */
25
- interface Data$1 {}
25
+ interface Data$2 {}
26
26
 
27
27
  /**
28
28
  * One place in a source file.
@@ -70,7 +70,7 @@ interface Position {
70
70
  * But for example in markdown, a `thematicBreak` (`***`), is neither literal
71
71
  * nor parent, but still a node.
72
72
  */
73
- interface Node$1 {
73
+ interface Node$2 {
74
74
  /**
75
75
  * Node type.
76
76
  */
@@ -79,7 +79,7 @@ interface Node$1 {
79
79
  /**
80
80
  * Info from the ecosystem.
81
81
  */
82
- data?: Data$1 | undefined;
82
+ data?: Data$2 | undefined;
83
83
 
84
84
  /**
85
85
  * Position of a node in a source document.
@@ -98,11 +98,11 @@ interface Node$1 {
98
98
  * For example, in XML, an element is a parent of different things, such as
99
99
  * comments, text, and further elements.
100
100
  */
101
- interface Parent$1 extends Node$1 {
101
+ interface Parent$2 extends Node$2 {
102
102
  /**
103
103
  * List of children.
104
104
  */
105
- children: Node$1[];
105
+ children: Node$2[];
106
106
  }
107
107
 
108
108
  // ## Enumeration
@@ -232,7 +232,7 @@ interface Resource {
232
232
  * }
233
233
  * ```
234
234
  */
235
- interface Data extends Data$1 {}
235
+ interface Data$1 extends Data$2 {}
236
236
 
237
237
  // ## Content maps
238
238
 
@@ -370,7 +370,7 @@ interface PhrasingContentMap {
370
370
  link: Link;
371
371
  linkReference: LinkReference;
372
372
  strong: Strong;
373
- text: Text;
373
+ text: Text$1;
374
374
  }
375
375
 
376
376
  /**
@@ -379,7 +379,7 @@ interface PhrasingContentMap {
379
379
  * To register custom mdast nodes, add them to {@link RootContentMap}.
380
380
  * They will be automatically added here.
381
381
  */
382
- type RootContent = RootContentMap[keyof RootContentMap];
382
+ type RootContent$1 = RootContentMap$1[keyof RootContentMap$1];
383
383
 
384
384
  /**
385
385
  * Registry of all mdast nodes that can occur as children of {@link Root}.
@@ -400,7 +400,7 @@ type RootContent = RootContentMap[keyof RootContentMap];
400
400
  *
401
401
  * For a union of all {@link Root} children, see {@link RootContent}.
402
402
  */
403
- interface RootContentMap {
403
+ interface RootContentMap$1 {
404
404
  blockquote: Blockquote;
405
405
  break: Break;
406
406
  code: Code;
@@ -423,7 +423,7 @@ interface RootContentMap {
423
423
  table: Table;
424
424
  tableCell: TableCell;
425
425
  tableRow: TableRow;
426
- text: Text;
426
+ text: Text$1;
427
427
  thematicBreak: ThematicBreak;
428
428
  yaml: Yaml;
429
429
  }
@@ -495,7 +495,7 @@ interface TableContentMap {
495
495
  *
496
496
  * For a union of all registered mdast literals, see {@link Literals}.
497
497
  */
498
- interface Literal extends Node {
498
+ interface Literal$1 extends Node$1 {
499
499
  /**
500
500
  * Plain-text value.
501
501
  */
@@ -515,11 +515,11 @@ interface Literal extends Node {
515
515
  *
516
516
  * For a union of all registered mdast nodes, see {@link Nodes}.
517
517
  */
518
- interface Node extends Node$1 {
518
+ interface Node$1 extends Node$2 {
519
519
  /**
520
520
  * Info from the ecosystem.
521
521
  */
522
- data?: Data | undefined;
522
+ data?: Data$1 | undefined;
523
523
  }
524
524
 
525
525
  /**
@@ -529,11 +529,11 @@ interface Node extends Node$1 {
529
529
  *
530
530
  * For a union of all registered mdast parents, see {@link Parents}.
531
531
  */
532
- interface Parent extends Node {
532
+ interface Parent$1 extends Node$1 {
533
533
  /**
534
534
  * List of children.
535
535
  */
536
- children: RootContent[];
536
+ children: RootContent$1[];
537
537
  }
538
538
 
539
539
  // ## Concrete nodes
@@ -541,7 +541,7 @@ interface Parent extends Node {
541
541
  /**
542
542
  * Markdown block quote.
543
543
  */
544
- interface Blockquote extends Parent {
544
+ interface Blockquote extends Parent$1 {
545
545
  /**
546
546
  * Node type of mdast block quote.
547
547
  */
@@ -559,12 +559,12 @@ interface Blockquote extends Parent {
559
559
  /**
560
560
  * Info associated with mdast block quote nodes by the ecosystem.
561
561
  */
562
- interface BlockquoteData extends Data {}
562
+ interface BlockquoteData extends Data$1 {}
563
563
 
564
564
  /**
565
565
  * Markdown break.
566
566
  */
567
- interface Break extends Node {
567
+ interface Break extends Node$1 {
568
568
  /**
569
569
  * Node type of mdast break.
570
570
  */
@@ -578,12 +578,12 @@ interface Break extends Node {
578
578
  /**
579
579
  * Info associated with mdast break nodes by the ecosystem.
580
580
  */
581
- interface BreakData extends Data {}
581
+ interface BreakData extends Data$1 {}
582
582
 
583
583
  /**
584
584
  * Markdown code (flow) (block).
585
585
  */
586
- interface Code extends Literal {
586
+ interface Code extends Literal$1 {
587
587
  /**
588
588
  * Node type of mdast code (flow).
589
589
  */
@@ -607,12 +607,12 @@ interface Code extends Literal {
607
607
  /**
608
608
  * Info associated with mdast code (flow) (block) nodes by the ecosystem.
609
609
  */
610
- interface CodeData extends Data {}
610
+ interface CodeData extends Data$1 {}
611
611
 
612
612
  /**
613
613
  * Markdown definition.
614
614
  */
615
- interface Definition extends Node, Association, Resource {
615
+ interface Definition extends Node$1, Association, Resource {
616
616
  /**
617
617
  * Node type of mdast definition.
618
618
  */
@@ -626,12 +626,12 @@ interface Definition extends Node, Association, Resource {
626
626
  /**
627
627
  * Info associated with mdast definition nodes by the ecosystem.
628
628
  */
629
- interface DefinitionData extends Data {}
629
+ interface DefinitionData extends Data$1 {}
630
630
 
631
631
  /**
632
632
  * Markdown GFM delete (strikethrough).
633
633
  */
634
- interface Delete extends Parent {
634
+ interface Delete extends Parent$1 {
635
635
  /**
636
636
  * Node type of mdast GFM delete.
637
637
  */
@@ -649,12 +649,12 @@ interface Delete extends Parent {
649
649
  /**
650
650
  * Info associated with mdast GFM delete nodes by the ecosystem.
651
651
  */
652
- interface DeleteData extends Data {}
652
+ interface DeleteData extends Data$1 {}
653
653
 
654
654
  /**
655
655
  * Markdown emphasis.
656
656
  */
657
- interface Emphasis extends Parent {
657
+ interface Emphasis extends Parent$1 {
658
658
  /**
659
659
  * Node type of mdast emphasis.
660
660
  */
@@ -672,12 +672,12 @@ interface Emphasis extends Parent {
672
672
  /**
673
673
  * Info associated with mdast emphasis nodes by the ecosystem.
674
674
  */
675
- interface EmphasisData extends Data {}
675
+ interface EmphasisData extends Data$1 {}
676
676
 
677
677
  /**
678
678
  * Markdown GFM footnote definition.
679
679
  */
680
- interface FootnoteDefinition extends Parent, Association {
680
+ interface FootnoteDefinition extends Parent$1, Association {
681
681
  /**
682
682
  * Node type of mdast GFM footnote definition.
683
683
  */
@@ -695,12 +695,12 @@ interface FootnoteDefinition extends Parent, Association {
695
695
  /**
696
696
  * Info associated with mdast GFM footnote definition nodes by the ecosystem.
697
697
  */
698
- interface FootnoteDefinitionData extends Data {}
698
+ interface FootnoteDefinitionData extends Data$1 {}
699
699
 
700
700
  /**
701
701
  * Markdown GFM footnote reference.
702
702
  */
703
- interface FootnoteReference extends Association, Node {
703
+ interface FootnoteReference extends Association, Node$1 {
704
704
  /**
705
705
  * Node type of mdast GFM footnote reference.
706
706
  */
@@ -714,12 +714,12 @@ interface FootnoteReference extends Association, Node {
714
714
  /**
715
715
  * Info associated with mdast GFM footnote reference nodes by the ecosystem.
716
716
  */
717
- interface FootnoteReferenceData extends Data {}
717
+ interface FootnoteReferenceData extends Data$1 {}
718
718
 
719
719
  /**
720
720
  * Markdown heading.
721
721
  */
722
- interface Heading extends Parent {
722
+ interface Heading extends Parent$1 {
723
723
  /**
724
724
  * Node type of mdast heading.
725
725
  */
@@ -743,12 +743,12 @@ interface Heading extends Parent {
743
743
  /**
744
744
  * Info associated with mdast heading nodes by the ecosystem.
745
745
  */
746
- interface HeadingData extends Data {}
746
+ interface HeadingData extends Data$1 {}
747
747
 
748
748
  /**
749
749
  * Markdown HTML.
750
750
  */
751
- interface Html extends Literal {
751
+ interface Html extends Literal$1 {
752
752
  /**
753
753
  * Node type of mdast HTML.
754
754
  */
@@ -762,12 +762,12 @@ interface Html extends Literal {
762
762
  /**
763
763
  * Info associated with mdast HTML nodes by the ecosystem.
764
764
  */
765
- interface HtmlData extends Data {}
765
+ interface HtmlData extends Data$1 {}
766
766
 
767
767
  /**
768
768
  * Markdown image.
769
769
  */
770
- interface Image extends Alternative, Node, Resource {
770
+ interface Image extends Alternative, Node$1, Resource {
771
771
  /**
772
772
  * Node type of mdast image.
773
773
  */
@@ -781,12 +781,12 @@ interface Image extends Alternative, Node, Resource {
781
781
  /**
782
782
  * Info associated with mdast image nodes by the ecosystem.
783
783
  */
784
- interface ImageData extends Data {}
784
+ interface ImageData extends Data$1 {}
785
785
 
786
786
  /**
787
787
  * Markdown image reference.
788
788
  */
789
- interface ImageReference extends Alternative, Node, Reference {
789
+ interface ImageReference extends Alternative, Node$1, Reference {
790
790
  /**
791
791
  * Node type of mdast image reference.
792
792
  */
@@ -800,12 +800,12 @@ interface ImageReference extends Alternative, Node, Reference {
800
800
  /**
801
801
  * Info associated with mdast image reference nodes by the ecosystem.
802
802
  */
803
- interface ImageReferenceData extends Data {}
803
+ interface ImageReferenceData extends Data$1 {}
804
804
 
805
805
  /**
806
806
  * Markdown code (text) (inline).
807
807
  */
808
- interface InlineCode extends Literal {
808
+ interface InlineCode extends Literal$1 {
809
809
  /**
810
810
  * Node type of mdast code (text).
811
811
  */
@@ -819,12 +819,12 @@ interface InlineCode extends Literal {
819
819
  /**
820
820
  * Info associated with mdast code (text) (inline) nodes by the ecosystem.
821
821
  */
822
- interface InlineCodeData extends Data {}
822
+ interface InlineCodeData extends Data$1 {}
823
823
 
824
824
  /**
825
825
  * Markdown link.
826
826
  */
827
- interface Link extends Parent, Resource {
827
+ interface Link extends Parent$1, Resource {
828
828
  /**
829
829
  * Node type of mdast link.
830
830
  */
@@ -842,12 +842,12 @@ interface Link extends Parent, Resource {
842
842
  /**
843
843
  * Info associated with mdast link nodes by the ecosystem.
844
844
  */
845
- interface LinkData extends Data {}
845
+ interface LinkData extends Data$1 {}
846
846
 
847
847
  /**
848
848
  * Markdown link reference.
849
849
  */
850
- interface LinkReference extends Parent, Reference {
850
+ interface LinkReference extends Parent$1, Reference {
851
851
  /**
852
852
  * Node type of mdast link reference.
853
853
  */
@@ -865,12 +865,12 @@ interface LinkReference extends Parent, Reference {
865
865
  /**
866
866
  * Info associated with mdast link reference nodes by the ecosystem.
867
867
  */
868
- interface LinkReferenceData extends Data {}
868
+ interface LinkReferenceData extends Data$1 {}
869
869
 
870
870
  /**
871
871
  * Markdown list.
872
872
  */
873
- interface List extends Parent {
873
+ interface List extends Parent$1 {
874
874
  /**
875
875
  * Node type of mdast list.
876
876
  */
@@ -902,12 +902,12 @@ interface List extends Parent {
902
902
  /**
903
903
  * Info associated with mdast list nodes by the ecosystem.
904
904
  */
905
- interface ListData extends Data {}
905
+ interface ListData extends Data$1 {}
906
906
 
907
907
  /**
908
908
  * Markdown list item.
909
909
  */
910
- interface ListItem extends Parent {
910
+ interface ListItem extends Parent$1 {
911
911
  /**
912
912
  * Node type of mdast list item.
913
913
  */
@@ -937,12 +937,12 @@ interface ListItem extends Parent {
937
937
  /**
938
938
  * Info associated with mdast list item nodes by the ecosystem.
939
939
  */
940
- interface ListItemData extends Data {}
940
+ interface ListItemData extends Data$1 {}
941
941
 
942
942
  /**
943
943
  * Markdown paragraph.
944
944
  */
945
- interface Paragraph extends Parent {
945
+ interface Paragraph extends Parent$1 {
946
946
  /**
947
947
  * Node type of mdast paragraph.
948
948
  */
@@ -960,14 +960,14 @@ interface Paragraph extends Parent {
960
960
  /**
961
961
  * Info associated with mdast paragraph nodes by the ecosystem.
962
962
  */
963
- interface ParagraphData extends Data {}
963
+ interface ParagraphData extends Data$1 {}
964
964
 
965
965
  /**
966
966
  * Document fragment or a whole document.
967
967
  *
968
968
  * Should be used as the root of a tree and must not be used as a child.
969
969
  */
970
- interface Root extends Parent {
970
+ interface Root$1 extends Parent$1 {
971
971
  /**
972
972
  * Node type of mdast root.
973
973
  */
@@ -975,18 +975,18 @@ interface Root extends Parent {
975
975
  /**
976
976
  * Data associated with the mdast root.
977
977
  */
978
- data?: RootData | undefined;
978
+ data?: RootData$1 | undefined;
979
979
  }
980
980
 
981
981
  /**
982
982
  * Info associated with mdast root nodes by the ecosystem.
983
983
  */
984
- interface RootData extends Data {}
984
+ interface RootData$1 extends Data$1 {}
985
985
 
986
986
  /**
987
987
  * Markdown strong.
988
988
  */
989
- interface Strong extends Parent {
989
+ interface Strong extends Parent$1 {
990
990
  /**
991
991
  * Node type of mdast strong.
992
992
  */
@@ -1004,12 +1004,12 @@ interface Strong extends Parent {
1004
1004
  /**
1005
1005
  * Info associated with mdast strong nodes by the ecosystem.
1006
1006
  */
1007
- interface StrongData extends Data {}
1007
+ interface StrongData extends Data$1 {}
1008
1008
 
1009
1009
  /**
1010
1010
  * Markdown GFM table.
1011
1011
  */
1012
- interface Table extends Parent {
1012
+ interface Table extends Parent$1 {
1013
1013
  /**
1014
1014
  * Node type of mdast GFM table.
1015
1015
  */
@@ -1031,12 +1031,12 @@ interface Table extends Parent {
1031
1031
  /**
1032
1032
  * Info associated with mdast GFM table nodes by the ecosystem.
1033
1033
  */
1034
- interface TableData extends Data {}
1034
+ interface TableData extends Data$1 {}
1035
1035
 
1036
1036
  /**
1037
1037
  * Markdown GFM table row.
1038
1038
  */
1039
- interface TableRow extends Parent {
1039
+ interface TableRow extends Parent$1 {
1040
1040
  /**
1041
1041
  * Node type of mdast GFM table row.
1042
1042
  */
@@ -1054,12 +1054,12 @@ interface TableRow extends Parent {
1054
1054
  /**
1055
1055
  * Info associated with mdast GFM table row nodes by the ecosystem.
1056
1056
  */
1057
- interface TableRowData extends Data {}
1057
+ interface TableRowData extends Data$1 {}
1058
1058
 
1059
1059
  /**
1060
1060
  * Markdown GFM table cell.
1061
1061
  */
1062
- interface TableCell extends Parent {
1062
+ interface TableCell extends Parent$1 {
1063
1063
  /**
1064
1064
  * Node type of mdast GFM table cell.
1065
1065
  */
@@ -1077,12 +1077,12 @@ interface TableCell extends Parent {
1077
1077
  /**
1078
1078
  * Info associated with mdast GFM table cell nodes by the ecosystem.
1079
1079
  */
1080
- interface TableCellData extends Data {}
1080
+ interface TableCellData extends Data$1 {}
1081
1081
 
1082
1082
  /**
1083
1083
  * Markdown text.
1084
1084
  */
1085
- interface Text extends Literal {
1085
+ interface Text$1 extends Literal$1 {
1086
1086
  /**
1087
1087
  * Node type of mdast text.
1088
1088
  */
@@ -1090,18 +1090,18 @@ interface Text extends Literal {
1090
1090
  /**
1091
1091
  * Data associated with the mdast text.
1092
1092
  */
1093
- data?: TextData | undefined;
1093
+ data?: TextData$1 | undefined;
1094
1094
  }
1095
1095
 
1096
1096
  /**
1097
1097
  * Info associated with mdast text nodes by the ecosystem.
1098
1098
  */
1099
- interface TextData extends Data {}
1099
+ interface TextData$1 extends Data$1 {}
1100
1100
 
1101
1101
  /**
1102
1102
  * Markdown thematic break (horizontal rule).
1103
1103
  */
1104
- interface ThematicBreak extends Node {
1104
+ interface ThematicBreak extends Node$1 {
1105
1105
  /**
1106
1106
  * Node type of mdast thematic break.
1107
1107
  */
@@ -1115,12 +1115,12 @@ interface ThematicBreak extends Node {
1115
1115
  /**
1116
1116
  * Info associated with mdast thematic break nodes by the ecosystem.
1117
1117
  */
1118
- interface ThematicBreakData extends Data {}
1118
+ interface ThematicBreakData extends Data$1 {}
1119
1119
 
1120
1120
  /**
1121
1121
  * Markdown YAML.
1122
1122
  */
1123
- interface Yaml extends Literal {
1123
+ interface Yaml extends Literal$1 {
1124
1124
  /**
1125
1125
  * Node type of mdast YAML.
1126
1126
  */
@@ -1134,7 +1134,29 @@ interface Yaml extends Literal {
1134
1134
  /**
1135
1135
  * Info associated with mdast YAML nodes by the ecosystem.
1136
1136
  */
1137
- interface YamlData extends Data {}
1137
+ interface YamlData extends Data$1 {}
1138
+
1139
+ // ## Interfaces
1140
+
1141
+ /**
1142
+ * Info associated with hast nodes by the ecosystem.
1143
+ *
1144
+ * This space is guaranteed to never be specified by unist or hast.
1145
+ * But you can use it in utilities and plugins to store data.
1146
+ *
1147
+ * This type can be augmented to register custom data.
1148
+ * For example:
1149
+ *
1150
+ * ```ts
1151
+ * declare module 'hast' {
1152
+ * interface Data {
1153
+ * // `someNode.data.myId` is typed as `number | undefined`
1154
+ * myId?: number | undefined
1155
+ * }
1156
+ * }
1157
+ * ```
1158
+ */
1159
+ interface Data extends Data$2 {}
1138
1160
 
1139
1161
  /**
1140
1162
  * Info associated with an element.
@@ -1143,6 +1165,222 @@ interface Properties {
1143
1165
  [PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
1144
1166
  }
1145
1167
 
1168
+ // ## Content maps
1169
+
1170
+ /**
1171
+ * Union of registered hast nodes that can occur in {@link Element}.
1172
+ *
1173
+ * To register mote custom hast nodes, add them to {@link ElementContentMap}.
1174
+ * They will be automatically added here.
1175
+ */
1176
+ type ElementContent = ElementContentMap[keyof ElementContentMap];
1177
+
1178
+ /**
1179
+ * Registry of all hast nodes that can occur as children of {@link Element}.
1180
+ *
1181
+ * For a union of all {@link Element} children, see {@link ElementContent}.
1182
+ */
1183
+ interface ElementContentMap {
1184
+ comment: Comment;
1185
+ element: Element;
1186
+ text: Text;
1187
+ }
1188
+
1189
+ /**
1190
+ * Union of registered hast nodes that can occur in {@link Root}.
1191
+ *
1192
+ * To register custom hast nodes, add them to {@link RootContentMap}.
1193
+ * They will be automatically added here.
1194
+ */
1195
+ type RootContent = RootContentMap[keyof RootContentMap];
1196
+
1197
+ /**
1198
+ * Registry of all hast nodes that can occur as children of {@link Root}.
1199
+ *
1200
+ * > 👉 **Note**: {@link Root} does not need to be an entire document.
1201
+ * > it can also be a fragment.
1202
+ *
1203
+ * For a union of all {@link Root} children, see {@link RootContent}.
1204
+ */
1205
+ interface RootContentMap {
1206
+ comment: Comment;
1207
+ doctype: Doctype;
1208
+ element: Element;
1209
+ text: Text;
1210
+ }
1211
+
1212
+ // ## Abstract nodes
1213
+
1214
+ /**
1215
+ * Abstract hast node.
1216
+ *
1217
+ * This interface is supposed to be extended.
1218
+ * If you can use {@link Literal} or {@link Parent}, you should.
1219
+ * But for example in HTML, a `Doctype` is neither literal nor parent, but
1220
+ * still a node.
1221
+ *
1222
+ * To register custom hast nodes, add them to {@link RootContentMap} and other
1223
+ * places where relevant (such as {@link ElementContentMap}).
1224
+ *
1225
+ * For a union of all registered hast nodes, see {@link Nodes}.
1226
+ */
1227
+ interface Node extends Node$2 {
1228
+ /**
1229
+ * Info from the ecosystem.
1230
+ */
1231
+ data?: Data | undefined;
1232
+ }
1233
+
1234
+ /**
1235
+ * Abstract hast node that contains the smallest possible value.
1236
+ *
1237
+ * This interface is supposed to be extended if you make custom hast nodes.
1238
+ *
1239
+ * For a union of all registered hast literals, see {@link Literals}.
1240
+ */
1241
+ interface Literal extends Node {
1242
+ /**
1243
+ * Plain-text value.
1244
+ */
1245
+ value: string;
1246
+ }
1247
+
1248
+ /**
1249
+ * Abstract hast node that contains other hast nodes (*children*).
1250
+ *
1251
+ * This interface is supposed to be extended if you make custom hast nodes.
1252
+ *
1253
+ * For a union of all registered hast parents, see {@link Parents}.
1254
+ */
1255
+ interface Parent extends Node {
1256
+ /**
1257
+ * List of children.
1258
+ */
1259
+ children: RootContent[];
1260
+ }
1261
+
1262
+ // ## Concrete nodes
1263
+
1264
+ /**
1265
+ * HTML comment.
1266
+ */
1267
+ interface Comment extends Literal {
1268
+ /**
1269
+ * Node type of HTML comments in hast.
1270
+ */
1271
+ type: "comment";
1272
+ /**
1273
+ * Data associated with the comment.
1274
+ */
1275
+ data?: CommentData | undefined;
1276
+ }
1277
+
1278
+ /**
1279
+ * Info associated with hast comments by the ecosystem.
1280
+ */
1281
+ interface CommentData extends Data {}
1282
+
1283
+ /**
1284
+ * HTML document type.
1285
+ */
1286
+ interface Doctype extends Node$2 {
1287
+ /**
1288
+ * Node type of HTML document types in hast.
1289
+ */
1290
+ type: "doctype";
1291
+ /**
1292
+ * Data associated with the doctype.
1293
+ */
1294
+ data?: DoctypeData | undefined;
1295
+ }
1296
+
1297
+ /**
1298
+ * Info associated with hast doctypes by the ecosystem.
1299
+ */
1300
+ interface DoctypeData extends Data {}
1301
+
1302
+ /**
1303
+ * HTML element.
1304
+ */
1305
+ interface Element extends Parent {
1306
+ /**
1307
+ * Node type of elements.
1308
+ */
1309
+ type: "element";
1310
+ /**
1311
+ * Tag name (such as `'body'`) of the element.
1312
+ */
1313
+ tagName: string;
1314
+ /**
1315
+ * Info associated with the element.
1316
+ */
1317
+ properties: Properties;
1318
+ /**
1319
+ * Children of element.
1320
+ */
1321
+ children: ElementContent[];
1322
+ /**
1323
+ * When the `tagName` field is `'template'`, a `content` field can be
1324
+ * present.
1325
+ */
1326
+ content?: Root | undefined;
1327
+ /**
1328
+ * Data associated with the element.
1329
+ */
1330
+ data?: ElementData | undefined;
1331
+ }
1332
+
1333
+ /**
1334
+ * Info associated with hast elements by the ecosystem.
1335
+ */
1336
+ interface ElementData extends Data {}
1337
+
1338
+ /**
1339
+ * Document fragment or a whole document.
1340
+ *
1341
+ * Should be used as the root of a tree and must not be used as a child.
1342
+ *
1343
+ * Can also be used as the value for the content field on a `'template'` element.
1344
+ */
1345
+ interface Root extends Parent {
1346
+ /**
1347
+ * Node type of hast root.
1348
+ */
1349
+ type: "root";
1350
+ /**
1351
+ * Children of root.
1352
+ */
1353
+ children: RootContent[];
1354
+ /**
1355
+ * Data associated with the hast root.
1356
+ */
1357
+ data?: RootData | undefined;
1358
+ }
1359
+
1360
+ /**
1361
+ * Info associated with hast root nodes by the ecosystem.
1362
+ */
1363
+ interface RootData extends Data {}
1364
+
1365
+ /**
1366
+ * HTML character data (plain text).
1367
+ */
1368
+ interface Text extends Literal {
1369
+ /**
1370
+ * Node type of HTML character data (plain text) in hast.
1371
+ */
1372
+ type: "text";
1373
+ /**
1374
+ * Data associated with the text.
1375
+ */
1376
+ data?: TextData | undefined;
1377
+ }
1378
+
1379
+ /**
1380
+ * Info associated with hast texts by the ecosystem.
1381
+ */
1382
+ interface TextData extends Data {}
1383
+
1146
1384
  /**
1147
1385
  * PipelineStage defines the execution order of plugins in the processing pipeline.
1148
1386
  * Plugins are sorted and executed in ascending order based on these stage values.
@@ -1185,6 +1423,16 @@ interface MdastPlugin {
1185
1423
  stage?: PipelineStage | PipelineStageName;
1186
1424
  /** Execution priority within the same stage. Lower values run earlier. */
1187
1425
  order?: number;
1426
+ /**
1427
+ * If true, this plugin is considered the "main" plugin for its stage.
1428
+ * When multiple plugins exist in the same stage, a 'main' plugin will
1429
+ * replace the default (first) plugin of that stage.
1430
+ */
1431
+ main?: boolean;
1432
+ /** Run this plugin before the named plugin (within the same stage). */
1433
+ before?: string;
1434
+ /** Run this plugin after the named plugin (within the same stage). */
1435
+ after?: string;
1188
1436
  }
1189
1437
  /**
1190
1438
  * Defines a document format, encompassing its input (parsing) and output (serialization) strategies.
@@ -1216,17 +1464,17 @@ interface MdastDataOrigin {
1216
1464
  [k: string]: unknown;
1217
1465
  }
1218
1466
  /** Represents a highlighted text (mark) node in mdast. */
1219
- interface MdastMark extends Parent$1 {
1467
+ interface MdastMark extends Parent$2 {
1220
1468
  type: 'mark';
1221
1469
  children: PhrasingContent[];
1222
1470
  }
1223
1471
  /** Represents a subscript text node in mdast. */
1224
- interface MdastSub extends Parent$1 {
1472
+ interface MdastSub extends Parent$2 {
1225
1473
  type: 'sub';
1226
1474
  children: PhrasingContent[];
1227
1475
  }
1228
1476
  /** Represents a superscript text node in mdast. */
1229
- interface MdastSup extends Parent$1 {
1477
+ interface MdastSup extends Parent$2 {
1230
1478
  type: 'sup';
1231
1479
  children: PhrasingContent[];
1232
1480
  }
@@ -1238,6 +1486,14 @@ declare module 'mdast' {
1238
1486
  hProperties?: Properties;
1239
1487
  /** Source origin information */
1240
1488
  _origin?: MdastDataOrigin;
1489
+ readability?: {
1490
+ title: string;
1491
+ byline: string;
1492
+ excerpt: string;
1493
+ siteName: string;
1494
+ lang: string;
1495
+ };
1496
+ [k: string]: any;
1241
1497
  }
1242
1498
  interface CodeData extends Data {
1243
1499
  /** Title of the code block */
@@ -1279,11 +1535,19 @@ declare class MdastBasePipeline {
1279
1535
  static getFormat(id: string): MdastFormat | undefined;
1280
1536
  protected input: VFileCompatible;
1281
1537
  protected queue: MdastPlugin[];
1538
+ protected _data: Record<string, any>;
1282
1539
  /**
1283
1540
  * Initializes a new pipeline instance with the given input.
1284
1541
  * @param input - Content to process (string, Buffer, VFile, or AST Node).
1285
1542
  */
1286
1543
  constructor(input: VFileCompatible);
1544
+ /**
1545
+ * Configures global data for the pipeline, which will be available to all plugins via this.data().
1546
+ * @param key - Data key or a record of multiple data entries.
1547
+ * @param value - Value to set (if key is a string).
1548
+ * @returns The pipeline instance for chaining.
1549
+ */
1550
+ data(key: string | Record<string, any>, value?: any): this;
1287
1551
  /**
1288
1552
  * Instance-level access to the global format registry.
1289
1553
  */
@@ -1321,20 +1585,27 @@ declare class MdastBasePipeline {
1321
1585
  */
1322
1586
  to(fmt: string | MdastFormat, overrides?: Record<string, any>): Promise<VFile>;
1323
1587
  /**
1324
- * Adds a plugin to the pipeline's compile stage.
1325
- * @param plugin - The unified plugin function.
1326
- * @param options - Arguments for the plugin.
1588
+ * Adds a plugin or an array of plugins to the pipeline's compile stage.
1589
+ * @param plugin - The unified plugin function, a MdastPlugin object, or an array of them.
1590
+ * @param options - Arguments for the plugin(s).
1327
1591
  * @returns The pipeline instance for chaining.
1328
1592
  */
1329
- use(plugin: any, ...options: any[]): this;
1593
+ use(plugin: Plugin | MdastPlugin | (Plugin | MdastPlugin)[], ...options: any[]): this;
1330
1594
  /**
1331
- * Adds a plugin to the pipeline at a specific stage.
1595
+ * Adds a plugin or an array of plugins to the pipeline at a specific stage.
1332
1596
  * @param stage - The stage name or numeric value.
1333
- * @param plugin - The unified plugin function.
1334
- * @param options - Arguments for the plugin.
1597
+ * @param plugin - The unified plugin function, a MdastPlugin object, or an array of them.
1598
+ * @param options - Arguments for the plugin(s).
1599
+ * @returns The pipeline instance for chaining.
1600
+ */
1601
+ useAt(stage: PipelineStage | PipelineStageName, plugin: Plugin | MdastPlugin | (Plugin | MdastPlugin)[], ...options: any[]): this;
1602
+ /**
1603
+ * Adds a plugin or an array of plugins to the pipeline. The stage is taken from the plugin object(s).
1604
+ * @param plugin - The MdastPlugin object or an array of them.
1605
+ * @param options - Arguments for the plugin(s) (overrides plugin.options if provided).
1335
1606
  * @returns The pipeline instance for chaining.
1336
1607
  */
1337
- useAt(stage: PipelineStageName, plugin: any, ...options: any[]): this;
1608
+ useAt(plugin: MdastPlugin | MdastPlugin[], ...options: any[]): this;
1338
1609
  /**
1339
1610
  * Sets the priority order for the most recently added plugin.
1340
1611
  * Plugins with lower order run earlier within the same stage.
@@ -1342,6 +1613,16 @@ declare class MdastBasePipeline {
1342
1613
  * @returns The pipeline instance for chaining.
1343
1614
  */
1344
1615
  priority(order: number): this;
1616
+ /**
1617
+ * Modifies the options of a plugin that is already in the pipeline queue.
1618
+ * Searches from the end of the queue and updates the first match found.
1619
+ *
1620
+ * @param pluginName - The name of the plugin to modify.
1621
+ * Matches against explicit plugin name or function name.
1622
+ * @param options - The new options to pass to the plugin (replaces existing options).
1623
+ * @returns The pipeline instance for chaining.
1624
+ */
1625
+ configure(pluginName: string, ...options: any[]): this;
1345
1626
  /**
1346
1627
  * Assembles a unified processor based on the sorted plugin queue.
1347
1628
  * @protected
@@ -1375,16 +1656,16 @@ declare class MdastPipeline extends MdastBasePipeline {
1375
1656
  * @param options.overrides - Map for plugin option overrides.
1376
1657
  */
1377
1658
  toAst(options?: {
1378
- stage?: PipelineStageName;
1659
+ stage?: PipelineStage | PipelineStageName;
1379
1660
  overrides?: Record<string, any>;
1380
- }): Promise<Root>;
1661
+ }): Promise<Root$1>;
1381
1662
  /** Alias for toHtml() */
1382
1663
  toHTML(): Promise<string>;
1383
1664
  /** Alias for toAst() */
1384
1665
  toAST(options?: {
1385
- stage?: PipelineStageName;
1666
+ stage?: PipelineStage | PipelineStageName;
1386
1667
  overrides?: Record<string, any>;
1387
- }): Promise<Root>;
1668
+ }): Promise<Root$1>;
1388
1669
  }
1389
1670
  /**
1390
1671
  * Entry point for the fluent mdast-plus API.
@@ -1427,4 +1708,47 @@ declare function jsonParser(this: any): void;
1427
1708
  */
1428
1709
  declare const astFormat: MdastFormat;
1429
1710
 
1430
- export { DefaultPipelineStage, MdastBasePipeline, type MdastDataOrigin, type MdastFormat, type MdastMark, MdastPipeline, type MdastPlugin, type MdastSub, type MdastSup, PipelineStage, type PipelineStageName, astCompiler, astFormat, htmlFormat, jsonParser, markdownFormat, mdast };
1711
+ interface ReadabilityOptions {
1712
+ url?: string;
1713
+ readability?: Record<string, any> | false;
1714
+ jsdom?: Record<string, any>;
1715
+ 'rehype-parse'?: Record<string, any>;
1716
+ }
1717
+ /**
1718
+ * A unified/rehype plugin that uses Mozilla's Readability to parse the input HTML.
1719
+ */
1720
+ declare const htmlReadability: Plugin<[ReadabilityOptions?], string, Root>;
1721
+ /**
1722
+ * Pre-configured MdastPlugin for html-readability.
1723
+ */
1724
+ declare const htmlReadabilityPlugin: {
1725
+ name: string;
1726
+ plugin: Plugin<[(ReadabilityOptions | undefined)?], string, Root>;
1727
+ stage: PipelineStage;
1728
+ main: boolean;
1729
+ };
1730
+ /**
1731
+ * Plugin to restore readability metadata after HAST to MDAST conversion.
1732
+ */
1733
+ declare const restoreReadabilityMetaPlugin: {
1734
+ name: string;
1735
+ plugin: () => (tree: any, file: any) => void;
1736
+ stage: PipelineStage;
1737
+ after: string;
1738
+ };
1739
+ /**
1740
+ * Combined plugins for HTML readability.
1741
+ */
1742
+ declare const htmlReadabilityPlugins: ({
1743
+ name: string;
1744
+ plugin: Plugin<[(ReadabilityOptions | undefined)?], string, Root>;
1745
+ stage: PipelineStage;
1746
+ main: boolean;
1747
+ } | {
1748
+ name: string;
1749
+ plugin: () => (tree: any, file: any) => void;
1750
+ stage: PipelineStage;
1751
+ after: string;
1752
+ })[];
1753
+
1754
+ export { DefaultPipelineStage, MdastBasePipeline, type MdastDataOrigin, type MdastFormat, type MdastMark, MdastPipeline, type MdastPlugin, type MdastSub, type MdastSup, PipelineStage, type PipelineStageName, type ReadabilityOptions, astCompiler, astFormat, htmlFormat, htmlReadability, htmlReadabilityPlugin, htmlReadabilityPlugins, jsonParser, markdownFormat, mdast, restoreReadabilityMetaPlugin };