|
3 | 3 | * @typedef {import('unist').Point} Point
|
4 | 4 | * @typedef {import('mdast').Root} Root
|
5 | 5 | * @typedef {import('mdast').Content} Content
|
6 |
| - * @typedef {Root | Content} Node |
7 |
| - * @typedef {Extract<Node, UnistParent>} Parent |
| 6 | + * @typedef {import('mdast').TopLevelContent} TopLevelContent |
| 7 | + * @typedef {import('mdast').ListContent} ListContent |
| 8 | + * @typedef {import('mdast').PhrasingContent} PhrasingContent |
8 | 9 | */
|
9 | 10 |
|
10 | 11 | /**
|
| 12 | + * @typedef {Root | Content} Node |
| 13 | + * @typedef {Extract<Node, UnistParent>} Parent |
| 14 | + * @typedef {TopLevelContent | ListContent} FlowContent |
| 15 | + * |
11 | 16 | * @typedef TrackFields
|
12 | 17 | * Info on where we are in the document we are generating.
|
13 | 18 | * @property {Point} now
|
14 | 19 | * Current point.
|
15 | 20 | * @property {number} lineShift
|
16 | 21 | * Number of columns each line will be shifted by wrapping nodes.
|
17 |
| - */ |
18 |
| - |
19 |
| -/** |
| 22 | + * |
20 | 23 | * @typedef SafeFields
|
21 | 24 | * Info on the characters that are around the current thing we are
|
22 | 25 | * generating.
|
23 | 26 | * @property {string} before
|
24 | 27 | * Characters before this (guaranteed to be one, can be more).
|
25 | 28 | * @property {string} after
|
26 | 29 | * Characters after this (guaranteed to be one, can be more).
|
27 |
| - */ |
28 |
| - |
29 |
| -/** |
| 30 | + * |
30 | 31 | * @typedef {TrackFields & SafeFields} Info
|
31 | 32 | * Info on the surrounding of the node that is serialized.
|
32 |
| - */ |
33 |
| - |
34 |
| -/** |
| 33 | + * |
35 | 34 | * @callback Enter
|
36 | 35 | * Enter something.
|
37 | 36 | * @param {string} type
|
38 | 37 | * Label, more similar to a micromark event than an mdast node type.
|
39 | 38 | * @returns {Exit}
|
40 | 39 | * Revert.
|
41 |
| - */ |
42 |
| - |
43 |
| -/** |
| 40 | + * |
44 | 41 | * @callback Exit
|
45 | 42 | * Exit something.
|
46 | 43 | * @returns {void}
|
47 | 44 | * Nothing.
|
48 |
| - */ |
49 |
| - |
50 |
| -/** |
| 45 | + * |
51 | 46 | * @typedef State
|
52 | 47 | * Info passed around about the current state.
|
53 | 48 | * @property {Array<string>} stack
|
|
70 | 65 | * List marker currently in use.
|
71 | 66 | * @property {string | undefined} bulletLastUsed
|
72 | 67 | * List marker previously in use.
|
73 |
| - */ |
74 |
| - |
75 |
| -/** |
| 68 | + * |
76 | 69 | * @callback Handle
|
77 | 70 | * Handle a particular node.
|
78 | 71 | * @param {any} node
|
|
85 | 78 | * Info on the surrounding of the node that is serialized.
|
86 | 79 | * @returns {string}
|
87 | 80 | * Serialized markdown representing `node`.
|
88 |
| - */ |
89 |
| - |
90 |
| -/** |
| 81 | + * |
91 | 82 | * @typedef {Record<string, Handle>} Handlers
|
92 | 83 | * Handle particular nodes.
|
93 | 84 | *
|
94 | 85 | * Each key is a node type, each value its corresponding handler.
|
95 |
| - */ |
96 |
| - |
97 |
| -/** |
| 86 | + * |
98 | 87 | * @callback Join
|
99 | 88 | * How to join two blocks.
|
100 | 89 | *
|
|
131 | 120 | * > One such example is when returning `0` for two paragraphs, which will
|
132 | 121 | * > result in the text running together, and in the future to be seen as
|
133 | 122 | * > one paragraph.
|
134 |
| - */ |
135 |
| - |
136 |
| -/** |
| 123 | + * |
137 | 124 | * @typedef Unsafe
|
138 | 125 | * Schema that defines when a character cannot occur.
|
139 | 126 | * @property {string} character
|
|
153 | 140 | * The unsafe pattern (this whole object) compiled as a regex.
|
154 | 141 | *
|
155 | 142 | * This is internal and must not be defined.
|
156 |
| - */ |
157 |
| - |
158 |
| -/** |
| 143 | + * |
159 | 144 | * @typedef Options
|
160 | 145 | * Configuration (optional).
|
161 | 146 | * @property {'-' | '*' | '+' | null | undefined} [bullet='*']
|
|
0 commit comments