19
19
* [ API] ( #api )
20
20
* [ ` fromMarkdown(value[, encoding][, options]) ` ] ( #frommarkdownvalue-encoding-options )
21
21
* [ ` CompileContext ` ] ( #compilecontext )
22
+ * [ ` CompileData ` ] ( #compiledata )
22
23
* [ ` Encoding ` ] ( #encoding )
23
24
* [ ` Extension ` ] ( #extension )
24
25
* [ ` Handle ` ] ( #handle )
@@ -169,9 +170,9 @@ mdast compiler context (TypeScript type).
169
170
* ` tokenStack ` (` Array<[Token, OnEnterError | undefined]> ` )
170
171
— stack of tokens
171
172
* ` getData ` (` (key: string) => unknown ` )
172
- — get data from the key/value store
173
+ — get data from the key/value store (see [ ` CompileData ` ] [ api-compiledata ] )
173
174
* ` setData ` (` (key: string, value?: unknown) => void ` )
174
- — set data into the key/value store
175
+ — set data into the key/value store (see [ ` CompileData ` ] [ api-compiledata ] )
175
176
* ` buffer ` (` () => void ` )
176
177
— capture some of the output data
177
178
* ` resume ` (` () => string ` )
@@ -185,6 +186,28 @@ mdast compiler context (TypeScript type).
185
186
* ` config ` (` Required<Extension> ` )
186
187
— configuration
187
188
189
+ ### ` CompileData `
190
+
191
+ Interface of tracked data (TypeScript type).
192
+
193
+ ###### Type
194
+
195
+ ``` ts
196
+ interface CompileData { /* see code */ }
197
+ ```
198
+
199
+ When working on extensions that use more data, extend the corresponding
200
+ interface to register their types:
201
+
202
+ ``` ts
203
+ declare module ' mdast-util-from-markdown' {
204
+ interface CompileData {
205
+ // Register a new field.
206
+ mathFlowInside? : boolean | undefined
207
+ }
208
+ }
209
+ ```
210
+
188
211
### ` Encoding `
189
212
190
213
Encodings supported by the [ ` Buffer ` ] [ buffer ] class (TypeScript type).
@@ -363,6 +386,7 @@ The syntax tree is [mdast][].
363
386
364
387
This package is fully typed with [TypeScript][].
365
388
It exports the additional types [ ` CompileContext ` ][api-compilecontext],
389
+ [ ` CompileData ` ][api-compiledata],
366
390
[ ` Encoding ` ][api-encoding],
367
391
[ ` Extension ` ][api-extension],
368
392
[ ` Handle ` ][api-handle],
@@ -499,6 +523,8 @@ abide by its terms.
499
523
500
524
[api-compilecontext]: #compilecontext
501
525
526
+ [api-compiledata]: #compiledata
527
+
502
528
[api-encoding]: #encoding
503
529
504
530
[api-extension]: #extension
0 commit comments