4
4
5
5
***
6
6
7
- ** mdast** is a specification for representing Markdown in a [ syntax
7
+ ** mdast** is a specification for representing markdown in a [ syntax
8
8
tree] [ syntax-tree ] .
9
- It implements the [ ** unist** ] [ unist ] spec .
10
- It can represent several flavours of [ Markdown ] [ ] , such as [ CommonMark] [ ]
9
+ It implements ** [ unist] [ ] ** .
10
+ It can represent several flavours of [ markdown ] [ ] , such as [ CommonMark] [ ]
11
11
and [ GitHub Flavored Markdown] [ gfm ] .
12
12
13
13
This document may not be released.
@@ -58,6 +58,7 @@ The latest released version is [`4.0.0`][latest].
58
58
* [ GFM] ( #gfm )
59
59
* [ Frontmatter] ( #frontmatter )
60
60
* [ Footnotes] ( #footnotes )
61
+ * [ MDX] ( #mdx )
61
62
* [ Glossary] ( #glossary )
62
63
* [ List of utilities] ( #list-of-utilities )
63
64
* [ References] ( #references )
@@ -69,10 +70,10 @@ The latest released version is [`4.0.0`][latest].
69
70
70
71
## Introduction
71
72
72
- This document defines a format for representing [ Markdown ] [ ] as an [ abstract
73
+ This document defines a format for representing [ markdown ] [ ] as an [ abstract
73
74
syntax tree] [ syntax-tree ] .
74
- Development of mdast started in July 2014, in [ ** remark** ] [ remark ] , before
75
- [ unist ] [ ] existed.
75
+ Development of mdast started in July 2014, in ** [ remark] [ ] ** , before [ unist ] [ ]
76
+ existed.
76
77
This specification is written in a [ Web IDL] [ webidl ] -like grammar.
77
78
78
79
### Where this specification fits
@@ -99,8 +100,8 @@ interface Parent <: UnistParent {
99
100
}
100
101
```
101
102
102
- ** Parent** ([ ** UnistParent** ] [ dfn-unist-parent ] ) represents a node in mdast
103
- containing other nodes (said to be [ * children* ] [ term-child ] ).
103
+ ** Parent** ([ ** UnistParent** ] [ dfn-unist-parent ] ) represents an abstract
104
+ interface in mdast containing other nodes (said to be [ * children* ] [ term-child ] ).
104
105
105
106
Its content is limited to only other [ ** mdast content** ] [ dfn-mdast-content ] .
106
107
@@ -112,8 +113,8 @@ interface Literal <: UnistLiteral {
112
113
}
113
114
```
114
115
115
- ** Literal** ([ ** UnistLiteral** ] [ dfn-unist-literal ] ) represents a node in mdast
116
- containing a value.
116
+ ** Literal** ([ ** UnistLiteral** ] [ dfn-unist-literal ] ) represents an abstract
117
+ interface in mdast containing a value.
117
118
118
119
Its ` value ` field is a ` string ` .
119
120
@@ -129,9 +130,9 @@ interface Root <: Parent {
129
130
130
131
** Root** can be used as the [ * root* ] [ term-root ] of a [ * tree* ] [ term-tree ] , never
131
132
as a [ * child* ] [ term-child ] .
132
- Its content model is not limited to [ ** flow** ] [ dfn-flow-content ] content, but
133
- can contain any [ ** mdast content** ] [ dfn-mdast-content ] with the restriction that
134
- all content must be of the same category.
133
+ Its content model is ** not** limited to [ ** flow** ] [ dfn-flow-content ] content,
134
+ but instead can contain any [ ** mdast content** ] [ dfn-mdast-content ] with the
135
+ restriction that all content must be of the same category.
135
136
136
137
### ` Paragraph `
137
138
@@ -148,7 +149,7 @@ with a particular point or idea.
148
149
** Paragraph** can be used where [ ** content** ] [ dfn-content ] is expected.
149
150
Its content model is [ ** phrasing** ] [ dfn-phrasing-content ] content.
150
151
151
- For example, the following Markdown :
152
+ For example, the following markdown :
152
153
153
154
``` markdown
154
155
Alpha bravo charlie.
@@ -181,7 +182,7 @@ Its content model is [**phrasing**][dfn-phrasing-content] content.
181
182
A ` depth ` field must be present.
182
183
A value of ` 1 ` is said to be the highest rank and ` 6 ` the lowest.
183
184
184
- For example, the following Markdown :
185
+ For example, the following markdown :
185
186
186
187
``` markdown
187
188
# Alpha
@@ -212,7 +213,7 @@ scene change in a story, a transition to another topic, or a new document.
212
213
expected.
213
214
It has no content model.
214
215
215
- For example, the following Markdown :
216
+ For example, the following markdown :
216
217
217
218
``` markdown
218
219
***
@@ -240,7 +241,7 @@ somewhere else.
240
241
expected.
241
242
Its content model is also [ ** flow** ] [ dfn-flow-content ] content.
242
243
243
- For example, the following Markdown :
244
+ For example, the following markdown :
244
245
245
246
``` markdown
246
247
> Alpha bravo charlie.
@@ -288,7 +289,7 @@ It represents that one or more of its children are separated with a blank line
288
289
from its [ siblings] [ term-sibling ] (when ` true ` ), or not (when ` false ` or not
289
290
present).
290
291
291
- For example, the following Markdown :
292
+ For example, the following markdown :
292
293
293
294
``` markdown
294
295
1. foo
@@ -333,7 +334,7 @@ A `spread` field can be present.
333
334
It represents that the item contains two or more [ * children* ] [ term-child ]
334
335
separated by a blank line (when ` true ` ), or not (when ` false ` or not present).
335
336
336
- For example, the following Markdown :
337
+ For example, the following markdown :
337
338
338
339
``` markdown
339
340
* bar
@@ -369,7 +370,7 @@ Its content is represented by its `value` field.
369
370
HTML nodes do not have the restriction of being valid or complete HTML
370
371
([ \[ HTML\] ] [ html ] ) constructs.
371
372
372
- For example, the following Markdown :
373
+ For example, the following markdown :
373
374
374
375
``` markdown
375
376
<div>
@@ -406,7 +407,7 @@ It represents the language of computer code being marked up.
406
407
If the ` lang ` field is present, a ` meta ` field can be present.
407
408
It represents custom information relating to the node.
408
409
409
- For example, the following Markdown :
410
+ For example, the following markdown :
410
411
411
412
``` markdown
412
413
foo()
@@ -423,7 +424,7 @@ Yields:
423
424
}
424
425
```
425
426
426
- And the following Markdown :
427
+ And the following markdown :
427
428
428
429
```` markdown
429
430
```js highlight-line="2"
@@ -467,7 +468,7 @@ It has no content model.
467
468
[ ** LinkReferences** ] [ dfn-link-reference ] and
468
469
[ ** ImageReferences** ] [ dfn-image-reference ] .
469
470
470
- For example, the following Markdown :
471
+ For example, the following markdown :
471
472
472
473
``` markdown
473
474
[Alpha]: https://example.com
@@ -499,7 +500,7 @@ interface Text <: Literal {
499
500
expected.
500
501
Its content is represented by its ` value ` field.
501
502
502
- For example, the following Markdown :
503
+ For example, the following markdown :
503
504
504
505
``` markdown
505
506
Alpha bravo charlie.
@@ -527,7 +528,7 @@ contents.
527
528
expected.
528
529
Its content model is [ ** transparent** ] [ dfn-transparent-content ] content.
529
530
530
- For example, the following Markdown :
531
+ For example, the following markdown :
531
532
532
533
``` markdown
533
534
*alpha* _bravo_
@@ -568,7 +569,7 @@ or urgency for its contents.
568
569
expected.
569
570
Its content model is [ ** transparent** ] [ dfn-transparent-content ] content.
570
571
571
- For example, the following Markdown :
572
+ For example, the following markdown :
572
573
573
574
``` markdown
574
575
**alpha** __bravo__
@@ -611,7 +612,7 @@ Its content is represented by its `value` field.
611
612
This node relates to the [ ** flow** ] [ dfn-flow-content ] content concept
612
613
[ ** Code** ] [ dfn-code ] .
613
614
614
- For example, the following Markdown :
615
+ For example, the following markdown :
615
616
616
617
``` markdown
617
618
`foo()`
@@ -638,7 +639,7 @@ addresses.
638
639
expected.
639
640
It has no content model.
640
641
641
- For example, the following Markdown :
642
+ For example, the following markdown :
642
643
643
644
``` markdown
644
645
foo··
@@ -677,7 +678,7 @@ Its content model is [**static phrasing**][dfn-static-phrasing-content] content.
677
678
678
679
** Link** includes the mixin [ ** Resource** ] [ dfn-mxn-resource ] .
679
680
680
- For example, the following Markdown :
681
+ For example, the following markdown :
681
682
682
683
``` markdown
683
684
[alpha](https://example.com "bravo")
@@ -714,7 +715,7 @@ It has no content model, but is described by its `alt` field.
714
715
** Image** includes the mixins [ ** Resource** ] [ dfn-mxn-resource ] and
715
716
[ ** Alternative** ] [ dfn-mxn-alternative ] .
716
717
717
- For example, the following Markdown :
718
+ For example, the following markdown :
718
719
719
720
``` markdown
720
721

@@ -753,7 +754,7 @@ Its content model is [**static phrasing**][dfn-static-phrasing-content] content.
753
754
754
755
** LinkReferences** should be associated with a [ ** Definition** ] [ dfn-definition ] .
755
756
756
- For example, the following Markdown :
757
+ For example, the following markdown :
757
758
758
759
``` markdown
759
760
[alpha][Bravo]
@@ -794,7 +795,7 @@ It has no content model, but is described by its `alt` field.
794
795
795
796
** ImageReference** should be associated with a [ ** Definition** ] [ dfn-definition ] .
796
797
797
- For example, the following Markdown :
798
+ For example, the following markdown :
798
799
799
800
``` markdown
800
801
![alpha][bravo]
@@ -1005,7 +1006,7 @@ Its content model is also [**flow**][dfn-flow-content] content.
1005
1006
** FootnoteDefinition** should be associated with
1006
1007
[ ** FootnoteReferences** ] [ dfn-footnote-reference ] .
1007
1008
1008
- For example, the following Markdown :
1009
+ For example, the following markdown :
1009
1010
1010
1011
``` markdown
1011
1012
[^alpha]: bravo and charlie.
@@ -1047,7 +1048,7 @@ It has no content model.
1047
1048
** FootnoteReference** should be associated with a
1048
1049
[ ** FootnoteDefinition** ] [ dfn-footnote-definition ] .
1049
1050
1050
- For example, the following Markdown :
1051
+ For example, the following markdown :
1051
1052
1052
1053
``` markdown
1053
1054
[^alpha]
@@ -1084,7 +1085,7 @@ An `align` field can be present.
1084
1085
If present, it must be a list of [ ** alignType** s] [ dfn-enum-align-type ] .
1085
1086
It represents how cells in columns are aligned.
1086
1087
1087
- For example, the following Markdown :
1088
+ For example, the following markdown :
1088
1089
1089
1090
``` markdown
1090
1091
| foo | bar |
@@ -1196,7 +1197,7 @@ accurate or no longer relevant.
1196
1197
expected.
1197
1198
Its content model is [ ** transparent** ] [ dfn-transparent-content ] content.
1198
1199
1199
- For example, the following Markdown :
1200
+ For example, the following markdown :
1200
1201
1201
1202
``` markdown
1202
1203
~~alpha~~
@@ -1284,7 +1285,7 @@ the document in the YAML ([\[YAML\]][yaml]) data serialisation language.
1284
1285
expected.
1285
1286
Its content is represented by its ` value ` field.
1286
1287
1287
- For example, the following Markdown :
1288
+ For example, the following markdown :
1288
1289
1289
1290
``` markdown
1290
1291
---
@@ -1339,7 +1340,7 @@ document that is outside its flow.
1339
1340
expected.
1340
1341
Its content model is also [ ** phrasing** ] [ dfn-phrasing-content ] content.
1341
1342
1342
- For example, the following Markdown :
1343
+ For example, the following markdown :
1343
1344
1344
1345
``` markdown
1345
1346
^[alpha bravo]
@@ -1360,6 +1361,10 @@ Yields:
1360
1361
type StaticPhrasingContentFootnotes = Footnote | StaticPhrasingContent
1361
1362
```
1362
1363
1364
+ ### MDX
1365
+
1366
+ See [ ` remark-mdx ` ] ( https://mdxjs.com/packages/remark-mdx/#syntax-tree ) .
1367
+
1363
1368
## Glossary
1364
1369
1365
1370
See the [ unist glossary] [ glossary ] .
@@ -1371,49 +1376,49 @@ See the [unist list of utilities][utilities] for more utilities.
1371
1376
<!-- lint disable list-item-spacing-->
1372
1377
1373
1378
* [ ` mdast-add-list-metadata ` ] ( https://gitlab.com/staltz/mdast-add-list-metadata )
1374
- — Enhances the metadata of list and listItem nodes
1379
+ — enhance the metadata of ` list ` and ` listItem ` nodes
1375
1380
* [ ` mdast-util-assert ` ] ( https://github.com/syntax-tree/mdast-util-assert )
1376
- — Assert nodes
1381
+ — assert nodes
1377
1382
* [ ` mdast-builder ` ] ( https://github.com/mike-north/mdast-builder )
1378
- — Build mdast structures with composable functions
1383
+ — build mdast structures with composable functions
1379
1384
* [ ` mdast-comment-marker ` ] ( https://github.com/syntax-tree/mdast-comment-marker )
1380
- — Parse a comment marker
1385
+ — parse a comment marker
1381
1386
* [ ` mdast-util-compact ` ] ( https://github.com/syntax-tree/mdast-util-compact )
1382
- — Make a tree compact
1387
+ — make a tree compact
1383
1388
* [ ` mdast-util-definitions ` ] ( https://github.com/syntax-tree/mdast-util-definitions )
1384
- — Find definition nodes
1389
+ — find definition nodes
1385
1390
* [ ` mdast-util-from-quill-delta ` ] ( https://github.com/syntax-tree/mdast-util-from-quill-delta )
1386
- — Transform Quill delta to mdast
1391
+ — transform Quill delta to mdast
1387
1392
* [ ` mdast-flatten-image-paragraphs ` ] ( https://gitlab.com/staltz/mdast-flatten-image-paragraphs )
1388
- — Flatten paragraph and image into one image node
1393
+ — flatten ` paragraph ` and ` image ` into one ` image ` node
1389
1394
* [ ` mdast-flatten-listitem-paragraphs ` ] ( https://gitlab.com/staltz/mdast-flatten-listitem-paragraphs )
1390
- — Flatten listItem and (nested) paragraph into one listItem node
1395
+ — flatten ` listItem ` and (nested) paragraph into one listItem node
1391
1396
* [ ` mdast-flatten-nested-lists ` ] ( https://gitlab.com/staltz/mdast-flatten-nested-lists )
1392
- — Transforms a tree to avoid lists inside lists
1397
+ — transform a tree to avoid lists in lists
1393
1398
* [ ` mdast-util-from-adf ` ] ( https://github.com/bitcrowd/mdast-util-from-adf )
1394
- — Build mdast sytax tree from Atlassian Document Format (ADF)
1399
+ — build mdast syntax tree from Atlassian Document Format (ADF)
1395
1400
* [ ` mdast-util-heading-range ` ] ( https://github.com/syntax-tree/mdast-util-heading-range )
1396
- — Markdown heading as ranges
1401
+ — markdown heading as ranges
1397
1402
* [ ` mdast-util-heading-style ` ] ( https://github.com/syntax-tree/mdast-util-heading-style )
1398
- — Get the style of a heading node
1403
+ — get the style of a heading node
1399
1404
* [ ` mdast-util-inject ` ] ( https://github.com/anandthakker/mdast-util-inject )
1400
- — Inject a tree into another at a given heading
1405
+ — inject a tree into another at a given heading
1401
1406
* [ ` mdast-move-images-to-root ` ] ( https://gitlab.com/staltz/mdast-move-images-to-root )
1402
- — Moves image nodes up the tree until they are strict children of the root
1407
+ — move image nodes up the tree until they are direct children of the root
1403
1408
* [ ` mdast-normalize-headings ` ] ( https://github.com/syntax-tree/mdast-normalize-headings )
1404
- — Ensure at most one top-level heading is in the document
1409
+ — ensure at most one top-level heading is in the document
1405
1410
* [ ` mdast-util-phrasing ` ] ( https://github.com/syntax-tree/mdast-util-phrasing )
1406
- — Check if a node is phrasing content
1411
+ — check if a node is phrasing content
1407
1412
* [ ` mdast-squeeze-paragraphs ` ] ( https://github.com/syntax-tree/mdast-squeeze-paragraphs )
1408
- — Remove empty paragraphs
1413
+ — remove empty paragraphs
1409
1414
* [ ` mdast-util-toc ` ] ( https://github.com/syntax-tree/mdast-util-toc )
1410
- — Generate a Table of Contents from a tree
1415
+ — generate a table of contents from a tree
1411
1416
* [ ` mdast-util-to-hast ` ] ( https://github.com/syntax-tree/mdast-util-to-hast )
1412
- — Transform to hast
1417
+ — transform to hast
1413
1418
* [ ` mdast-util-to-nlcst ` ] ( https://github.com/syntax-tree/mdast-util-to-nlcst )
1414
- — Transform to nlcst
1419
+ — transform to nlcst
1415
1420
* [ ` mdast-util-to-string ` ] ( https://github.com/syntax-tree/mdast-util-to-string )
1416
- — Get the plain text content of a node
1421
+ — get the plain text content of a node
1417
1422
* [ ` mdast-zone ` ] ( https://github.com/syntax-tree/mdast-zone )
1418
1423
— HTML comments as ranges or markers
1419
1424
0 commit comments