|
8 | 8 | [![Backers][backers-badge]][collective] |
9 | 9 | [![Chat][chat-badge]][chat] |
10 | 10 |
|
11 | | -Remove [`position`][position]s from a [Unist][] tree. |
| 11 | +[**unist**][unist] utility to remove [`position`][position]s from tree. |
12 | 12 |
|
13 | | -## Installation |
| 13 | +## Install |
14 | 14 |
|
15 | 15 | [npm][]: |
16 | 16 |
|
17 | | -```bash |
| 17 | +```sh |
18 | 18 | npm install unist-util-remove-position |
19 | 19 | ``` |
20 | 20 |
|
21 | 21 | ## Usage |
22 | 22 |
|
23 | | -```javascript |
| 23 | +```js |
24 | 24 | var remark = require('remark') |
25 | 25 | var removePosition = require('unist-util-remove-position') |
26 | 26 |
|
27 | 27 | var tree = remark().parse('Some _emphasis_, **importance**, and `code`.') |
28 | 28 |
|
29 | | -console.dir(removePosition(tree, true), {depth: null}) |
| 29 | +removePosition(tree, true) |
| 30 | + |
| 31 | +console.dir(tree, {depth: null}) |
30 | 32 | ``` |
31 | 33 |
|
32 | 34 | Yields: |
33 | 35 |
|
34 | 36 | ```js |
35 | | -{ type: 'root', |
36 | | - children: |
37 | | - [ { type: 'paragraph', |
38 | | - children: |
39 | | - [ { type: 'text', value: 'Some ' }, |
40 | | - { type: 'emphasis', |
41 | | - children: [ { type: 'text', value: 'emphasis' } ] }, |
42 | | - { type: 'text', value: ', ' }, |
43 | | - { type: 'strong', |
44 | | - children: [ { type: 'text', value: 'importance' } ] }, |
45 | | - { type: 'text', value: ', and ' }, |
46 | | - { type: 'inlineCode', value: 'code' }, |
47 | | - { type: 'text', value: '.' } ] } ] } |
| 37 | +{ |
| 38 | + type: 'root', |
| 39 | + children: [ |
| 40 | + { |
| 41 | + type: 'paragraph', |
| 42 | + children: [ |
| 43 | + { type: 'text', value: 'Some ' }, |
| 44 | + { |
| 45 | + type: 'emphasis', |
| 46 | + children: [ { type: 'text', value: 'emphasis' } ] |
| 47 | + }, |
| 48 | + { type: 'text', value: ', ' }, |
| 49 | + { |
| 50 | + type: 'strong', |
| 51 | + children: [ { type: 'text', value: 'importance' } ] |
| 52 | + }, |
| 53 | + { type: 'text', value: ', and ' }, |
| 54 | + { type: 'inlineCode', value: 'code' }, |
| 55 | + { type: 'text', value: '.' } |
| 56 | + ] |
| 57 | + } |
| 58 | + ] |
| 59 | +} |
48 | 60 | ``` |
49 | 61 |
|
50 | 62 | ## API |
51 | 63 |
|
52 | 64 | ### `removePosition(node[, force])` |
53 | 65 |
|
54 | | -Remove [`position`][position]s from [`node`][node]. If `force` is given, |
55 | | -uses `delete`, otherwise, sets `position`s to `undefined`. |
| 66 | +Remove [`position`][position]s from [`node`][node]. |
| 67 | +If `force` is given, uses `delete`, otherwise, sets `position`s to `undefined`. |
56 | 68 |
|
57 | 69 | ###### Returns |
58 | 70 |
|
59 | 71 | The given `node`. |
60 | 72 |
|
61 | 73 | ## Contribute |
62 | 74 |
|
63 | | -See [`contributing.md` in `syntax-tree/unist`][contributing] for ways to get |
| 75 | +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get |
64 | 76 | started. |
| 77 | +See [`support.md`][support] for ways to get help. |
65 | 78 |
|
66 | | -This organisation has a [Code of Conduct][coc]. By interacting with this |
67 | | -repository, organisation, or community you agree to abide by its terms. |
| 79 | +This project has a [Code of Conduct][coc]. |
| 80 | +By interacting with this repository, organisation, or community you agree to |
| 81 | +abide by its terms. |
68 | 82 |
|
69 | 83 | ## License |
70 | 84 |
|
@@ -104,12 +118,14 @@ repository, organisation, or community you agree to abide by its terms. |
104 | 118 |
|
105 | 119 | [author]: https://wooorm.com |
106 | 120 |
|
| 121 | +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md |
| 122 | + |
| 123 | +[support]: https://github.com/syntax-tree/.github/blob/master/support.md |
| 124 | + |
| 125 | +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md |
| 126 | + |
107 | 127 | [unist]: https://github.com/syntax-tree/unist |
108 | 128 |
|
109 | 129 | [position]: https://github.com/syntax-tree/unist#position |
110 | 130 |
|
111 | 131 | [node]: https://github.com/syntax-tree/unist#node |
112 | | - |
113 | | -[contributing]: https://github.com/syntax-tree/unist/blob/master/contributing.md |
114 | | - |
115 | | -[coc]: https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md |
|
0 commit comments