2020- [ Use] ( #use )
2121- [ API] ( #api )
2222 - [ ` fromDocs(value[, options]) ` ] ( #fromdocsvalue-options )
23+ - [ ` parseMarkdown<T>(value, options) ` ] ( #parsemarkdowntvalue-options )
24+ - [ ` MarkdownOptions ` ] ( #markdownoptions )
2325 - [ ` Options ` ] ( #options )
26+ - [ ` ParseMarkdownOptions ` ] ( #parsemarkdownoptions )
2427 - [ ` Transform ` ] ( #transform )
2528- [ Syntax] ( #syntax )
2629 - [ Docblock] ( #docblock )
@@ -203,14 +206,11 @@ console.log(inspect(tree))
203206root[9]
204207├─0 comment[3] (1:1-5:4, 0-122)
205208│ │ 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)
208210│ │ └─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)
211212│ │ └─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)
214214│ └─0 text " https://codewars.com/kata/55695bc4f75bbaea5100016b" (4:9-4:59, 68-118)
215215├─1 comment[2] (7:1-19:4, 124-414)
216216│ │ code: null
@@ -229,97 +229,84 @@ root[9]
229229│ │ └─1 code " 1, 1, 2, 3, 5, 8, 13, ..., 89, 144, 233, 377, ..." (13:4-15:7, 292-358)
230230│ │ lang: " txt"
231231│ │ 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)
234233│ └─0 typeExpression " Iterator<number, number>" (18:16-18:42, 384-410)
235234├─2 comment[4] (21:3-27:6, 479-583)
236235│ │ code: null
237236│ ├─0 description[1] (22:6-22:35, 488-517)
238237│ │ └─0 paragraph[1] (22:6-22:35, 488-517)
239238│ │ └─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)
246242│ ├─0 typeExpression " number" (26:14-26:22, 564-572)
247243│ └─1 text " fib1" (26:23-26:27, 573-577)
248244├─3 comment[4] (30:3-36:6, 609-714)
249245│ │ code: null
250246│ ├─0 description[1] (31:6-31:36, 618-648)
251247│ │ └─0 paragraph[1] (31:6-31:36, 618-648)
252248│ │ └─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)
259252│ ├─0 typeExpression " number" (35:14-35:22, 695-703)
260253│ └─1 text " fib2" (35:23-35:27, 704-708)
261254├─4 comment[4] (39:3-45:6, 740-834)
262255│ │ code: null
263256│ ├─0 description[1] (40:6-40:25, 749-768)
264257│ │ └─0 paragraph[1] (40:6-40:25, 749-768)
265258│ │ └─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)
272262│ ├─0 typeExpression " number" (44:14-44:22, 816-824)
273263│ └─1 text " max" (44:23-44:26, 825-828)
274264├─5 comment[2] (48:3-52:6, 862-995)
275265│ │ code: null
276266│ ├─0 description[1] (49:6-49:47, 871-912)
277267│ │ └─0 paragraph[1] (49:6-49:47, 871-912)
278268│ │ └─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)
281270│ ├─0 typeExpression " number" (51:13-51:21, 930-938)
282271│ └─1 text " [max=Number.MAX_SAFE_INTEGER] - Max sequence value" (51:22-51:72, 939-989)
283272├─6 comment[4] (58:3-65:6, 1122-1259)
284273│ │ code: null
285274│ ├─0 description[1] (59:6-59:24, 1131-1149)
286275│ │ └─0 paragraph[1] (59:6-59:24, 1131-1149)
287276│ │ └─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)
294280│ ├─0 typeExpression " IterableIterator<number>" (64:14-64:40, 1201-1227)
295281│ └─1 text " Current sequence iterator" (64:41-64:66, 1228-1253)
296282├─7 comment[4] (70:3-77:6, 1340-1504)
297283│ │ code: null
298284│ ├─0 description[1] (71:6-71:51, 1349-1394)
299285│ │ └─0 paragraph[1] (71:6-71:51, 1349-1394)
300286│ │ └─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)
307290│ ├─0 typeExpression " IteratorResult<number, number>" (76:14-76:46, 1446-1478)
308291│ └─1 text " Next sequence value" (76:47-76:66, 1479-1498)
309292└─8 comment[2] (79:5-83:8, 1559-1639)
310293 │ code: null
311294 ├─0 description[1] (80:8-80:33, 1570-1595)
312295 │ └─0 paragraph[1] (80:8-80:33, 1570-1595)
313296 │ └─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)
316298 ├─0 typeExpression " number" (82:15-82:23, 1617-1625)
317299 └─1 text " value" (82:24-82:29, 1626-1631)
318300```
319301
320302## API
321303
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.
323310
324311### ` fromDocs(value[, options]) `
325312
@@ -334,24 +321,65 @@ Turn docblocks into a syntax tree.
334321
335322docast tree ([ ` Root ` ] [ docast-tree ] )
336323
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+
337352### ` Options `
338353
339354Configuration options (TypeScript type).
340355
356+ #### Extends
357+
358+ - [ ` MarkdownOptions ` ] ( #markdownoptions )
359+
341360#### Properties
342361
343362- ` codeblocks ` (` OneOrMany<RegExp | string> ` , optional) &mdash ; block tag names, or regular expressions, matching block
344363 tags that should have their text converted to [ ` Code ` ] [ mdast-code ] when parsed as markdown
345- - ** default** : ` 'example' `
364+ - ** default** : ` '@ example' `
346365- ` from ` ([ ` docast.Point ` ] [ docast-point ] , optional) &mdash ; parser start point. node positions will be relative to this
347366 point
348367 - ** 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
353368- ` transforms ` ([ ` Transform[] ` ] ( #transform ) , optional) &mdash ; tree transforms
354369
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+
355383### ` Transform `
356384
357385Change the AST after parsing is complete (TypeScript type).
@@ -362,7 +390,7 @@ Change the AST after parsing is complete (TypeScript type).
362390
363391#### Returns
364392
365- Nothing
393+ nothing ( ` void ` )
366394
367395## Syntax
368396
@@ -390,14 +418,17 @@ See [`CONTRIBUTING.md`](CONTRIBUTING.md).
390418
391419[ docast-parse ] : https://github.com/flex-development/docast-parse
392420[ docast-point ] : https://github.com/flex-development/docast#point
421+ [ docast-position ] : https://github.com/flex-development/docast#position
393422[ docast-tree ] : https://github.com/flex-development/docast#root
394423[ docast ] : https://github.com/flex-development/docast
395424[ docblock ] : https://github.com/flex-development/docast#docblock-comment
396425[ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
397426[ esmsh ] : https://esm.sh/
398427[ mdast-code ] : https://github.com/syntax-tree/mdast#code
428+ [ mdast-content ] : https://github.com/syntax-tree/mdast#content-model
399429[ mdast-extension ] : https://github.com/syntax-tree/mdast-util-from-markdown#extension
400430[ mdast-util-from-markdown ] : https://github.com/syntax-tree/mdast-util-from-markdown
431+ [ mdast ] : https://github.com/syntax-tree/mdast
401432[ micromark-extension ] : https://github.com/micromark/micromark#extensions
402433[ micromark ] : https://github.com/micromark/micromark
403434[ typescript ] : https://www.typescriptlang.org
0 commit comments