20
20
- [ Use] ( #use )
21
21
- [ API] ( #api )
22
22
- [ ` fromDocs(value[, options]) ` ] ( #fromdocsvalue-options )
23
+ - [ ` parseMarkdown<T>(value, options) ` ] ( #parsemarkdowntvalue-options )
24
+ - [ ` MarkdownOptions ` ] ( #markdownoptions )
23
25
- [ ` Options ` ] ( #options )
26
+ - [ ` ParseMarkdownOptions ` ] ( #parsemarkdownoptions )
24
27
- [ ` Transform ` ] ( #transform )
25
28
- [ Syntax] ( #syntax )
26
29
- [ Docblock] ( #docblock )
@@ -203,14 +206,11 @@ console.log(inspect(tree))
203
206
root[9]
204
207
├─0 comment[3] (1:1-5:4, 0-122)
205
208
│ │ code: null
206
- │ ├─0 blockTag< file> [1] (2:4-2:27, 7-30)
207
- │ │ │ tag: " @file"
209
+ │ ├─0 blockTag< @file> [1] (2:4-2:27, 7-30)
208
210
│ │ └─0 text " FibonacciSequence" (2:10-2:27, 13-30)
209
- │ ├─1 blockTag< module> [1] (3:4-3:29, 34-59)
210
- │ │ │ tag: " @module"
211
+ │ ├─1 blockTag< @module> [1] (3:4-3:29, 34-59)
211
212
│ │ └─0 text " FibonacciSequence" (3:12-3:29, 42-59)
212
- │ └─2 blockTag< see> [1] (4:4-4:59, 63-118)
213
- │ │ tag: " @see"
213
+ │ └─2 blockTag< @see> [1] (4:4-4:59, 63-118)
214
214
│ └─0 text " https://codewars.com/kata/55695bc4f75bbaea5100016b" (4:9-4:59, 68-118)
215
215
├─1 comment[2] (7:1-19:4, 124-414)
216
216
│ │ code: null
@@ -229,97 +229,84 @@ root[9]
229
229
│ │ └─1 code " 1, 1, 2, 3, 5, 8, 13, ..., 89, 144, 233, 377, ..." (13:4-15:7, 292-358)
230
230
│ │ lang: " txt"
231
231
│ │ meta: null
232
- │ └─1 blockTag< implements> [1] (18:4-18:42, 372-410)
233
- │ │ tag: " @implements"
232
+ │ └─1 blockTag< @implements> [1] (18:4-18:42, 372-410)
234
233
│ └─0 typeExpression " Iterator<number, number>" (18:16-18:42, 384-410)
235
234
├─2 comment[4] (21:3-27:6, 479-583)
236
235
│ │ code: null
237
236
│ ├─0 description[1] (22:6-22:35, 488-517)
238
237
│ │ └─0 paragraph[1] (22:6-22:35, 488-517)
239
238
│ │ └─0 text " First managed sequence value." (22:6-22:35, 488-517)
240
- │ ├─1 blockTag< public> [0] (24:6-24:13, 528-535)
241
- │ │ tag: " @public"
242
- │ ├─2 blockTag< instance> [0] (25:6-25:15, 541-550)
243
- │ │ tag: " @instance"
244
- │ └─3 blockTag< member> [2] (26:6-26:27, 556-577)
245
- │ │ tag: " @member"
239
+ │ ├─1 blockTag< @public> [0] (24:6-24:13, 528-535)
240
+ │ ├─2 blockTag< @instance> [0] (25:6-25:15, 541-550)
241
+ │ └─3 blockTag< @member> [2] (26:6-26:27, 556-577)
246
242
│ ├─0 typeExpression " number" (26:14-26:22, 564-572)
247
243
│ └─1 text " fib1" (26:23-26:27, 573-577)
248
244
├─3 comment[4] (30:3-36:6, 609-714)
249
245
│ │ code: null
250
246
│ ├─0 description[1] (31:6-31:36, 618-648)
251
247
│ │ └─0 paragraph[1] (31:6-31:36, 618-648)
252
248
│ │ └─0 text " Second managed sequence value." (31:6-31:36, 618-648)
253
- │ ├─1 blockTag< public> [0] (33:6-33:13, 659-666)
254
- │ │ tag: " @public"
255
- │ ├─2 blockTag< instance> [0] (34:6-34:15, 672-681)
256
- │ │ tag: " @instance"
257
- │ └─3 blockTag< member> [2] (35:6-35:27, 687-708)
258
- │ │ tag: " @member"
249
+ │ ├─1 blockTag< @public> [0] (33:6-33:13, 659-666)
250
+ │ ├─2 blockTag< @instance> [0] (34:6-34:15, 672-681)
251
+ │ └─3 blockTag< @member> [2] (35:6-35:27, 687-708)
259
252
│ ├─0 typeExpression " number" (35:14-35:22, 695-703)
260
253
│ └─1 text " fib2" (35:23-35:27, 704-708)
261
254
├─4 comment[4] (39:3-45:6, 740-834)
262
255
│ │ code: null
263
256
│ ├─0 description[1] (40:6-40:25, 749-768)
264
257
│ │ └─0 paragraph[1] (40:6-40:25, 749-768)
265
258
│ │ └─0 text " Max sequence value." (40:6-40:25, 749-768)
266
- │ ├─1 blockTag< private> [0] (42:6-42:14, 779-787)
267
- │ │ tag: " @private"
268
- │ ├─2 blockTag< instance> [0] (43:6-43:15, 793-802)
269
- │ │ tag: " @instance"
270
- │ └─3 blockTag< member> [2] (44:6-44:26, 808-828)
271
- │ │ tag: " @member"
259
+ │ ├─1 blockTag< @private> [0] (42:6-42:14, 779-787)
260
+ │ ├─2 blockTag< @instance> [0] (43:6-43:15, 793-802)
261
+ │ └─3 blockTag< @member> [2] (44:6-44:26, 808-828)
272
262
│ ├─0 typeExpression " number" (44:14-44:22, 816-824)
273
263
│ └─1 text " max" (44:23-44:26, 825-828)
274
264
├─5 comment[2] (48:3-52:6, 862-995)
275
265
│ │ code: null
276
266
│ ├─0 description[1] (49:6-49:47, 871-912)
277
267
│ │ └─0 paragraph[1] (49:6-49:47, 871-912)
278
268
│ │ └─0 text " Create a new fibonacci sequence iterator." (49:6-49:47, 871-912)
279
- │ └─1 blockTag< param> [2] (51:6-51:72, 923-989)
280
- │ │ tag: " @param"
269
+ │ └─1 blockTag< @param> [2] (51:6-51:72, 923-989)
281
270
│ ├─0 typeExpression " number" (51:13-51:21, 930-938)
282
271
│ └─1 text " [max=Number.MAX_SAFE_INTEGER] - Max sequence value" (51:22-51:72, 939-989)
283
272
├─6 comment[4] (58:3-65:6, 1122-1259)
284
273
│ │ code: null
285
274
│ ├─0 description[1] (59:6-59:24, 1131-1149)
286
275
│ │ └─0 paragraph[1] (59:6-59:24, 1131-1149)
287
276
│ │ └─0 text " Iterable protocol." (59:6-59:24, 1131-1149)
288
- │ ├─1 blockTag< public> [0] (61:6-61:13, 1160-1167)
289
- │ │ tag: " @public"
290
- │ ├─2 blockTag< instance> [0] (62:6-62:15, 1173-1182)
291
- │ │ tag: " @instance"
292
- │ └─3 blockTag< return> [2] (64:6-64:66, 1193-1253)
293
- │ │ tag: " @return"
277
+ │ ├─1 blockTag< @public> [0] (61:6-61:13, 1160-1167)
278
+ │ ├─2 blockTag< @instance> [0] (62:6-62:15, 1173-1182)
279
+ │ └─3 blockTag< @return> [2] (64:6-64:66, 1193-1253)
294
280
│ ├─0 typeExpression " IterableIterator<number>" (64:14-64:40, 1201-1227)
295
281
│ └─1 text " Current sequence iterator" (64:41-64:66, 1228-1253)
296
282
├─7 comment[4] (70:3-77:6, 1340-1504)
297
283
│ │ code: null
298
284
│ ├─0 description[1] (71:6-71:51, 1349-1394)
299
285
│ │ └─0 paragraph[1] (71:6-71:51, 1349-1394)
300
286
│ │ └─0 text " Get the next value in the fibonacci sequence." (71:6-71:51, 1349-1394)
301
- │ ├─1 blockTag< public> [0] (73:6-73:13, 1405-1412)
302
- │ │ tag: " @public"
303
- │ ├─2 blockTag< instance> [0] (74:6-74:15, 1418-1427)
304
- │ │ tag: " @instance"
305
- │ └─3 blockTag< return> [2] (76:6-76:66, 1438-1498)
306
- │ │ tag: " @return"
287
+ │ ├─1 blockTag< @public> [0] (73:6-73:13, 1405-1412)
288
+ │ ├─2 blockTag< @instance> [0] (74:6-74:15, 1418-1427)
289
+ │ └─3 blockTag< @return> [2] (76:6-76:66, 1438-1498)
307
290
│ ├─0 typeExpression " IteratorResult<number, number>" (76:14-76:46, 1446-1478)
308
291
│ └─1 text " Next sequence value" (76:47-76:66, 1479-1498)
309
292
└─8 comment[2] (79:5-83:8, 1559-1639)
310
293
│ code: null
311
294
├─0 description[1] (80:8-80:33, 1570-1595)
312
295
│ └─0 paragraph[1] (80:8-80:33, 1570-1595)
313
296
│ └─0 text " Temporary sequence value." (80:8-80:33, 1570-1595)
314
- └─1 blockTag< const> [2] (82:8-82:29, 1610-1631)
315
- │ tag: " @const"
297
+ └─1 blockTag< @const> [2] (82:8-82:29, 1610-1631)
316
298
├─0 typeExpression " number" (82:15-82:23, 1617-1625)
317
299
└─1 text " value" (82:24-82:29, 1626-1631)
318
300
```
319
301
320
302
## API
321
303
322
- This package exports the identifier [ ` fromDocs ` ] ( #fromdocsvalue-options ) . There is no default export.
304
+ This package exports the following identifiers:
305
+
306
+ - [ ` fromDocs ` ] ( #fromdocsvalue-options )
307
+ - [ ` parseMarkdown ` ] ( #parsemarkdowntvalue-options )
308
+
309
+ There is no default export.
323
310
324
311
### ` fromDocs(value[, options]) `
325
312
@@ -334,24 +321,65 @@ Turn docblocks into a syntax tree.
334
321
335
322
docast tree ([ ` Root ` ] [ docast-tree ] )
336
323
324
+ ### ` parseMarkdown<T>(value, options) `
325
+
326
+ Turn markdown into [ ` mdast ` ] [ mdast ] child nodes, with respect for comment delimiters.
327
+
328
+ #### Type Parameters
329
+
330
+ - ` T ` ([ ` RootContent ` ] [ mdast-content ] ) &mdash ; ` mdast ` child node type
331
+
332
+ #### Parameters
333
+
334
+ - ` value ` ([ ` VFile ` ] [ vfile ] | ` string ` ) &mdash ; markdown to parse
335
+ - ` options ` ([ ` ParseMarkdownOptions ` ] ( #parsemarkdownoptions ) ) &mdash ; configuration options
336
+
337
+ #### Returns
338
+
339
+ ` mdast ` child node array (` T[] ` )
340
+
341
+ ### ` MarkdownOptions `
342
+
343
+ Markdown configuration options (TypeScript type).
344
+
345
+ #### Properties
346
+
347
+ - ` mdastExtensions ` ([ ` mdast.Extension[] ` ] [ mdast-extension ] , optional) &mdash ; markdown extensions to change how
348
+ micromark tokens are converted to nodes
349
+ - ` micromarkExtensions ` ([ ` micromark.Extension[] ` ] [ micromark-extension ] , optional) &mdash ; micromark extensions to
350
+ change how markdown is parsed
351
+
337
352
### ` Options `
338
353
339
354
Configuration options (TypeScript type).
340
355
356
+ #### Extends
357
+
358
+ - [ ` MarkdownOptions ` ] ( #markdownoptions )
359
+
341
360
#### Properties
342
361
343
362
- ` codeblocks ` (` OneOrMany<RegExp | string> ` , optional) &mdash ; block tag names, or regular expressions, matching block
344
363
tags that should have their text converted to [ ` Code ` ] [ mdast-code ] when parsed as markdown
345
- - ** default** : ` 'example' `
364
+ - ** default** : ` '@ example' `
346
365
- ` from ` ([ ` docast.Point ` ] [ docast-point ] , optional) &mdash ; parser start point. node positions will be relative to this
347
366
point
348
367
- ** default** : ` { column: 1, line: 1, offset: 0 } `
349
- - ` mdastExtensions ` ([ ` mdast.Extension[] ` ] [ mdast-extension ] , optional) &mdash ; markdown extensions to change how
350
- micromark tokens are converted to nodes
351
- - ` micromarkExtensions ` ([ ` micromark.Extension[] ` ] [ micromark-extension ] , optional) &mdash ; micromark extensions to
352
- change how markdown is parsed
353
368
- ` transforms ` ([ ` Transform[] ` ] ( #transform ) , optional) &mdash ; tree transforms
354
369
370
+ ### ` ParseMarkdownOptions `
371
+
372
+ Options for parsing markdown with respect for comment delimiters (TypeScript type).
373
+
374
+ #### Extends
375
+
376
+ - [ ` MarkdownOptions ` ] ( #markdownoptions )
377
+
378
+ #### Properties
379
+
380
+ - ` code ` (` boolean ` , optional) &mdash ; parse markdown value as fenced code
381
+ - ` position ` ([ ` Position ` ] [ docast-position ] ) &mdash ; position of markdown value
382
+
355
383
### ` Transform `
356
384
357
385
Change the AST after parsing is complete (TypeScript type).
@@ -362,7 +390,7 @@ Change the AST after parsing is complete (TypeScript type).
362
390
363
391
#### Returns
364
392
365
- Nothing
393
+ nothing ( ` void ` )
366
394
367
395
## Syntax
368
396
@@ -390,14 +418,17 @@ See [`CONTRIBUTING.md`](CONTRIBUTING.md).
390
418
391
419
[ docast-parse ] : https://github.com/flex-development/docast-parse
392
420
[ docast-point ] : https://github.com/flex-development/docast#point
421
+ [ docast-position ] : https://github.com/flex-development/docast#position
393
422
[ docast-tree ] : https://github.com/flex-development/docast#root
394
423
[ docast ] : https://github.com/flex-development/docast
395
424
[ docblock ] : https://github.com/flex-development/docast#docblock-comment
396
425
[ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
397
426
[ esmsh ] : https://esm.sh/
398
427
[ mdast-code ] : https://github.com/syntax-tree/mdast#code
428
+ [ mdast-content ] : https://github.com/syntax-tree/mdast#content-model
399
429
[ mdast-extension ] : https://github.com/syntax-tree/mdast-util-from-markdown#extension
400
430
[ mdast-util-from-markdown ] : https://github.com/syntax-tree/mdast-util-from-markdown
431
+ [ mdast ] : https://github.com/syntax-tree/mdast
401
432
[ micromark-extension ] : https://github.com/micromark/micromark#extensions
402
433
[ micromark ] : https://github.com/micromark/micromark
403
434
[ typescript ] : https://www.typescriptlang.org
0 commit comments