35
35
* [ Syntax] ( #syntax )
36
36
* [ Syntax tree] ( #syntax-tree )
37
37
* [ Types] ( #types )
38
+ * [ Compatibility] ( #compatibility )
38
39
* [ Security] ( #security )
39
40
* [ Related] ( #related )
40
41
* [ Contribute] ( #contribute )
@@ -65,7 +66,7 @@ Notable examples that deeply integrate with it are
65
66
## Install
66
67
67
68
This package is [ ESM only] [ esm ] .
68
- In Node.js (version 14.14+, or 16.0 +), install with [ npm] [ ] :
69
+ In Node.js (version 16 +), install with [ npm] [ ] :
69
70
70
71
``` sh
71
72
npm install mdast-util-to-markdown
@@ -133,7 +134,8 @@ console.log(toMarkdown(tree))
133
134
134
135
## API
135
136
136
- This package exports the identifiers ` toMarkdown ` and ` defaultHandlers ` .
137
+ This package exports the identifiers [ ` defaultHandlers ` ] [ api-default-handlers ]
138
+ and [ ` toMarkdown ` ] [ api-to-markdown ] .
137
139
There is no default export.
138
140
139
141
### ` toMarkdown(tree[, options]) `
@@ -144,7 +146,7 @@ Turn an **[mdast][]** syntax tree into markdown.
144
146
145
147
* ` tree ` ([ ` Node ` ] [ node ] )
146
148
— tree to serialize
147
- * ` options ` ([ ` Options ` ] [ options ] , optional)
149
+ * ` options ` ([ ` Options ` ] [ api- options] , optional)
148
150
— configuration
149
151
150
152
###### Returns
@@ -153,7 +155,7 @@ Serialized markdown representing `tree` (`string`).
153
155
154
156
### ` defaultHandlers `
155
157
156
- Default (CommonMark) handlers ([ ` Handlers ` ] [ handlers ] ).
158
+ Default (CommonMark) handlers ([ ` Handlers ` ] [ api- handlers] ).
157
159
158
160
### ` ConstructName `
159
161
@@ -202,9 +204,9 @@ Handle a particular node (TypeScript type).
202
204
— expected mdast node
203
205
* ` parent ` ([ ` Node ` ] [ node ] , optional)
204
206
— parent of ` node `
205
- * ` state ` ([ ` State ` ] [ state ] )
207
+ * ` state ` ([ ` State ` ] [ api- state] )
206
208
— info passed around about the current state
207
- * ` info ` ([ ` Info ` ] [ info ] )
209
+ * ` info ` ([ ` Info ` ] [ api- info] )
208
210
— info on the surrounding of the node that is serialized
209
211
210
212
###### Returns
@@ -216,7 +218,7 @@ Serialized markdown representing `node` (`string`).
216
218
Handle particular nodes (TypeScript type).
217
219
218
220
Each key is a node type (` Node['type'] ` ), each value its corresponding handler
219
- ([ ` Handle ` ] [ handle ] ).
221
+ ([ ` Handle ` ] [ api- handle] ).
220
222
221
223
###### Type
222
224
@@ -258,7 +260,7 @@ return defines how many blank lines to use between them.
258
260
— second of two adjacent siblings
259
261
* ` parent ` ([ ` Node ` ][node])
260
262
— parent of the two siblings
261
- * ` state ` ([ ` State ` ][state])
263
+ * ` state ` ([ ` State ` ][api- state])
262
264
— info passed around about the current state
263
265
264
266
###### Returns
@@ -383,7 +385,7 @@ Whether to increment the counter of ordered lists items (`boolean`, default:
383
385
384
386
###### ` options.listItemIndent `
385
387
386
- How to indent the content of list items (` 'one ' ` , ` 'tab ' ` , or ` 'mixed ' ` ,
388
+ How to indent the content of list items (` 'mixed ' ` , ` 'one ' ` , or ` 'tab ' ` ,
387
389
default: ` 'tab' ` ).
388
390
Either with the size of the bullet plus one space (when ` 'one' ` ), a tab stop
389
391
(` 'tab' ` ), or depending on the item and its parent list (` 'mixed' ` , uses ` 'one' `
@@ -429,7 +431,7 @@ Marker to use for strong (`'*'` or `'_'`, default: `'*'`).
429
431
Whether to join definitions without a blank line (` boolean ` , default: ` false ` ).
430
432
431
433
The default is to add blank lines between any flow (“block”) construct.
432
- Turning this option on is a shortcut for a [ ` Join ` ] [ join ] function like so:
434
+ Turning this option on is a shortcut for a [ ` Join ` ] [ api- join] function like so:
433
435
434
436
``` js
435
437
function joinTightDefinitions (left , right ) {
@@ -441,16 +443,16 @@ function joinTightDefinitions(left, right) {
441
443
442
444
###### ` options.handlers `
443
445
444
- Handle particular nodes ([ ` Handlers ` ] [ handlers ] , optional).
446
+ Handle particular nodes ([ ` Handlers ` ] [ api- handlers] , optional).
445
447
446
448
###### ` options.join `
447
449
448
- How to join blocks ([ ` Array<Join> ` ] [ join ] , optional).
450
+ How to join blocks ([ ` Array<Join> ` ] [ api- join] , optional).
449
451
450
452
###### ` options.unsafe `
451
453
452
- Schemas that define when characters cannot occur ( [ ` Array<Unsafe> ` ] [ unsafe ] ,
453
- optional).
454
+ Schemas that define when characters cannot occur
455
+ ( [ ` Array<Unsafe> ` ] [ api-unsafe ] , optional).
454
456
455
457
###### ` options.extensions `
456
458
@@ -479,7 +481,7 @@ Info passed around about the current state (TypeScript type).
479
481
480
482
###### Fields
481
483
482
- * ` stack ` ([ ` Array<ConstructName> ` ] [ constructname ] )
484
+ * ` stack ` ([ ` Array<ConstructName> ` ] [ api-construct-name ] )
483
485
— stack of constructs we’re in
484
486
* ` indexStack ` (` Array<number> ` )
485
487
— positions of child nodes in their parents
@@ -488,27 +490,27 @@ Info passed around about the current state (TypeScript type).
488
490
[ ` Association ` ] [ association ] )
489
491
* ` enter ` (` (construct: ConstructName) => () => undefined ` )
490
492
— enter a construct (returns a corresponding exit function)
491
- (see [ ` ConstructName ` ] [ constructname ] )
493
+ (see [ ` ConstructName ` ] [ api-construct-name ] )
492
494
* ` indentLines ` (` (value: string, map: Map) => string ` )
493
- — pad serialized markdown (see [ ` Map ` ] [ map ] )
495
+ — pad serialized markdown (see [ ` Map ` ] [ api- map] )
494
496
* ` containerFlow ` (` (parent: Node, info: Info) => string ` )
495
- — serialize flow children (see [ ` Info ` ] [ info ] )
497
+ — serialize flow children (see [ ` Info ` ] [ api- info] )
496
498
* ` containerPhrasing ` (` (parent: Node, info: Info) => string ` )
497
- — serialize phrasing children (see [ ` Info ` ] [ info ] )
499
+ — serialize phrasing children (see [ ` Info ` ] [ api- info] )
498
500
* ` createTracker ` (` (info: Info) => Tracker ` )
499
- — track positional info in the output (see [ ` Info ` ] [ info ] ,
500
- [ ` Tracker ` ] [ tracker ] )
501
+ — track positional info in the output (see [ ` Info ` ] [ api- info] ,
502
+ [ ` Tracker ` ] [ api- tracker] )
501
503
* ` safe ` (` (value: string, config: SafeConfig) => string ` )
502
- — make a string safe for embedding (see [ ` SafeConfig ` ] [ safeconfig ] )
503
- * ` options ` ([ ` Options ` ] [ options ] )
504
+ — make a string safe for embedding (see [ ` SafeConfig ` ] [ api-safe-config ] )
505
+ * ` options ` ([ ` Options ` ] [ api- options] )
504
506
— applied user configuration
505
- * ` unsafe ` ([ ` Array<Unsafe> ` ] [ unsafe ] )
507
+ * ` unsafe ` ([ ` Array<Unsafe> ` ] [ api- unsafe] )
506
508
— applied unsafe patterns
507
- * ` join ` ([ ` Array<Join> ` ] [ join ] )
509
+ * ` join ` ([ ` Array<Join> ` ] [ api- join] )
508
510
— applied join handlers
509
- * ` handle ` ([ ` Handle ` ] [ handle ] )
511
+ * ` handle ` ([ ` Handle ` ] [ api- handle] )
510
512
— call the configured handler for the given node
511
- * ` handlers ` ([ ` Handlers ` ] [ handlers ] )
513
+ * ` handlers ` ([ ` Handlers ` ] [ api- handlers] )
512
514
— applied handlers
513
515
* ` bulletCurrent ` (` string ` or ` undefined ` )
514
516
— list marker currently in use
@@ -539,11 +541,11 @@ Schema that defines when a character cannot occur (TypeScript type).
539
541
540
542
* ` character ` (` string ` )
541
543
— single unsafe character
542
- * ` inConstruct ` ([ ` ConstructName ` ] [ constructname ] , ` Array<ConstructName> ` ,
543
- optional)
544
+ * ` inConstruct ` ([ ` Array<ConstructName> ` ] [ api-construct-name ] ,
545
+ ` ConstructName ` , optional)
544
546
— constructs where this is bad
545
- * ` notInConstruct ` ([ ` ConstructName ` ] [ constructname ] , ` Array<ConstructName> ` ,
546
- optional)
547
+ * ` notInConstruct ` ([ ` Array<ConstructName> ` ] [ api-construct-name ] ,
548
+ ` ConstructName ` , optional)
547
549
— constructs where this is fine again
548
550
* ` before ` (` string ` , optional)
549
551
— ` character ` is bad when this is before it (cannot be used together with
@@ -595,9 +597,28 @@ The syntax tree is [mdast][].
595
597
## Types
596
598
597
599
This package is fully typed with [ TypeScript] [ ] .
598
- It exports the additional types ` ConstructName ` , ` ConstructNameMap ` , ` Handle ` ,
599
- ` Handlers ` , ` Info ` ` Join ` , ` Map ` , ` Options ` , ` SafeConfig ` , ` State ` , and
600
- ` Unsafe ` .
600
+ It exports the additional types
601
+ [ ` ConstructName ` ] [ api-construct-name ] ,
602
+ [ ` ConstructNameMap ` ] [ api-construct-name-map ] ,
603
+ [ ` Handle ` ] [ api-handle ] ,
604
+ [ ` Handlers ` ] [ api-handlers ] ,
605
+ [ ` Info ` ] [ api-info ] ,
606
+ [ ` Join ` ] [ api-join ] ,
607
+ [ ` Map ` ] [ api-map ] ,
608
+ [ ` Options ` ] [ api-options ] ,
609
+ [ ` SafeConfig ` ] [ api-safe-config ] ,
610
+ [ ` State ` ] [ api-State ] , and
611
+ [ ` Unsafe ` ] [ api-Unsafe ] .
612
+
613
+ ## Compatibility
614
+
615
+ Projects maintained by the unified collective are compatible with maintained
616
+ versions of Node.js.
617
+
618
+ When we cut a new major release, we drop support for unmaintained versions of
619
+ Node.
620
+ This means we try to keep the current release line, ` mdast-util-to-markdown@^1 ` ,
621
+ compatible with Node.js 12.
601
622
602
623
## Security
603
624
@@ -649,9 +670,9 @@ abide by its terms.
649
670
650
671
[ downloads ] : https://www.npmjs.com/package/mdast-util-to-markdown
651
672
652
- [ size-badge ] : https://img.shields.io/bundlephobia/minzip/ mdast-util-to-markdown.svg
673
+ [ size-badge ] : https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= mdast-util-to-markdown
653
674
654
- [ size ] : https://bundlephobia .com/result?p =mdast-util-to-markdown
675
+ [ size ] : https://bundlejs .com/?q =mdast-util-to-markdown
655
676
656
677
[ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
657
678
@@ -709,24 +730,30 @@ abide by its terms.
709
730
710
731
[ remark-stringify ] : https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
711
732
712
- [ constructname ] : #constructname
733
+ [ api-construct-name ] : #constructname
734
+
735
+ [ api-construct-name-map ] : #constructnamemap
736
+
737
+ [ api-default-handlers ] : #defaulthandlers
738
+
739
+ [ api-handle ] : #handle
713
740
714
- [ handle ] : #handle
741
+ [ api-handlers ] : #handlers
715
742
716
- [ handlers ] : #handlers
743
+ [ api-info ] : #info
717
744
718
- [ info ] : #info
745
+ [ api-join ] : #join
719
746
720
- [ join ] : #join
747
+ [ api-map ] : #map
721
748
722
- [ map ] : #map
749
+ [ api-options ] : #options
723
750
724
- [ options ] : #options
751
+ [ api-safe-config ] : #safeconfig
725
752
726
- [ safeconfig ] : #safeconfig
753
+ [ api-state ] : #state
727
754
728
- [ state ] : #state
755
+ [ api-to-markdown ] : #tomarkdowntree-options
729
756
730
- [ tracker ] : #tracker
757
+ [ api- tracker] : #tracker
731
758
732
- [ unsafe ] : #unsafe
759
+ [ api- unsafe] : #unsafe
0 commit comments