64
64
* @param {Root } tree
65
65
* Tree to transform.
66
66
* @returns {Root | undefined | null | void }
67
- * New tree (the default is to assume the tree is mutated ).
67
+ * New tree or nothing (in which case the current tree is used ).
68
68
*
69
69
* @callback Handle
70
70
* Handle a token.
92
92
*
93
93
* @callback OnExitError
94
94
* Handle the case where the `right` token is open but it is closed by
95
- * exitting the `left` token.
95
+ * exiting the `left` token.
96
96
* @param {Omit<CompileContext, 'sliceSerialize'> } this
97
97
* Context.
98
98
* @param {Token } left
125
125
* Change how markdown tokens from micromark are turned into mdast.
126
126
*
127
127
* @typedef CompileContext
128
- * mdast compiler context
128
+ * mdast compiler context.
129
129
* @property {Array<Node | Fragment> } stack
130
130
* Stack of nodes.
131
131
* @property {Array<TokenTuple> } tokenStack
132
132
* Stack of tokens.
133
- * @property {<Key extends keyof CompileData>(key: Key, value?: CompileData[Key]) => void } setData
134
- * Set data into the key-value store.
135
133
* @property {<Key extends keyof CompileData>(key: Key) => CompileData[Key] } getData
136
- * Get data from the key-value store.
134
+ * Get data from the key/value store.
135
+ * @property {<Key extends keyof CompileData>(key: Key, value?: CompileData[Key]) => void } setData
136
+ * Set data into the key/value store.
137
137
* @property {(this: CompileContext) => void } buffer
138
138
* Capture some of the output data.
139
139
* @property {(this: CompileContext) => string } resume
150
150
* @typedef FromMarkdownOptions
151
151
* Configuration for how to build mdast.
152
152
* @property {Array<Extension | Array<Extension>> | null | undefined } [mdastExtensions]
153
- * Extensions to change how tokens are turned into a tree.
153
+ * Extensions for this utility to change how tokens are turned into a tree.
154
154
*
155
155
* @typedef {ParseOptions & FromMarkdownOptions } Options
156
+ * Configuration.
156
157
*/
157
158
158
159
// To do: micromark: create a registry of tokens?
@@ -177,9 +178,9 @@ const own = {}.hasOwnProperty
177
178
178
179
/**
179
180
* @param value
180
- * Markdown to parse (`string` or `Buffer`) .
181
+ * Markdown to parse.
181
182
* @param encoding
182
- * Character encoding to understand `value` as when it’s a `Buffer` (`string`, default: `'utf8'`) .
183
+ * Character encoding for when `value` is `Buffer`.
183
184
* @param options
184
185
* Configuration.
185
186
* @returns
0 commit comments