1
- # mdast-util-compact [ ![ Build ] [ build-badge ]] [ build ] [ ![ Coverage ] [ coverage-badge ]] [ coverage ] [ ![ Downloads ] [ downloads-badge ]] [ downloads ] [ ![ Chat ] [ chat-badge ]] [ chat ]
1
+ # mdast-util-compact
2
2
3
- Make [ mdast] [ ] trees compact: collapse text nodes (when possible),
4
- and blockquotes (in commonmark mode).
3
+ [ ![ Build] [ build-badge ]] [ build ]
4
+ [ ![ Coverage] [ coverage-badge ]] [ coverage ]
5
+ [ ![ Downloads] [ downloads-badge ]] [ downloads ]
6
+ [ ![ Size] [ size-badge ]] [ size ]
7
+ [ ![ Sponsors] [ sponsors-badge ]] [ collective ]
8
+ [ ![ Backers] [ backers-badge ]] [ collective ]
9
+ [ ![ Chat] [ chat-badge ]] [ chat ]
5
10
6
- ## Installation
11
+ [ ** mdast** ] [ mdast ] utility to make trees compact: collapse text nodes (when
12
+ possible) and blockquotes (in commonmark mode).
13
+
14
+ ## Install
7
15
8
16
[ npm] [ ] :
9
17
10
- ``` bash
18
+ ``` sh
11
19
npm install mdast-util-compact
12
20
```
13
21
14
22
## Usage
15
23
16
- ``` javascript
24
+ ``` js
17
25
var u = require (' unist-builder' )
18
26
var compact = require (' mdast-util-compact' )
19
27
@@ -35,23 +43,25 @@ Yields:
35
43
36
44
### ` compact(tree[, commonmark]) `
37
45
38
- Visit the tree and collapse nodes. Combines adjacent text nodes (but
39
- not when they represent entities or escapes). If ` commonmark ` is ` true ` ,
40
- collapses ` blockquote ` nodes .
46
+ Walk the [ tree] [ ] and collapse nodes.
47
+ Combines adjacent [ text ] [ ] s (but not when they represent entities or escapes).
48
+ If ` commonmark ` is ` true ` , collapses [ blockquote ] [ ] s .
41
49
42
- Handles positional information properly.
50
+ Handles [ positional information] [ position-information ] properly.
43
51
44
52
###### Returns
45
53
46
54
The given ` tree ` .
47
55
48
56
## Contribute
49
57
50
- See [ ` contributing.md ` in ` syntax-tree/mdast ` ] [ contributing ] for ways to get
58
+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
51
59
started.
60
+ See [ ` support.md ` ] [ support ] for ways to get help.
52
61
53
- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
54
- repository, organisation, or community you agree to abide by its terms.
62
+ This project has a [ Code of Conduct] [ coc ] .
63
+ By interacting with this repository, organisation, or community you agree to
64
+ abide by its terms.
55
65
56
66
## License
57
67
@@ -71,18 +81,38 @@ repository, organisation, or community you agree to abide by its terms.
71
81
72
82
[ downloads ] : https://www.npmjs.com/package/mdast-util-compact
73
83
84
+ [ size-badge ] : https://img.shields.io/bundlephobia/minzip/mdast-util-compact.svg
85
+
86
+ [ size ] : https://bundlephobia.com/result?p=mdast-util-compact
87
+
88
+ [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
89
+
90
+ [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
91
+
92
+ [ collective ] : https://opencollective.com/unified
93
+
74
94
[ chat-badge ] : https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
75
95
76
- [ chat ] : https://spectrum.chat/unified/remark
96
+ [ chat ] : https://spectrum.chat/unified/syntax-tree
77
97
78
98
[ npm ] : https://docs.npmjs.com/cli/install
79
99
80
100
[ license ] : license
81
101
82
102
[ author ] : https://wooorm.com
83
103
104
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/master/contributing.md
105
+
106
+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
107
+
108
+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
109
+
84
110
[ mdast ] : https://github.com/syntax-tree/mdast
85
111
86
- [ contributing ] : https://github.com/syntax-tree/mdast/blob/master/contributing.md
112
+ [ tree ] : https://github.com/syntax-tree/unist#tree
113
+
114
+ [ position-information ] : https://github.com/syntax-tree/unist#positional-information
115
+
116
+ [ text ] : https://github.com/syntax-tree/mdast#text
87
117
88
- [ coc ] : https://github.com/syntax-tree/mdast/blob/master/code-of-conduct.md
118
+ [ blockquote ] : https://github.com/syntax-tree/mdast#blockquote
0 commit comments