Skip to content

Commit e997528

Browse files
committed
Update readme.md
1 parent 0aca600 commit e997528

File tree

1 file changed

+52
-19
lines changed

1 file changed

+52
-19
lines changed

readme.md

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
# mdast-util-definitions [![Build Status](https://img.shields.io/travis/wooorm/mdast-util-definitions.svg)](https://travis-ci.org/wooorm/mdast-util-definitions) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/mdast-util-definitions.svg)](https://codecov.io/github/wooorm/mdast-util-definitions)
1+
# mdast-util-definitions [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat]
22

3-
Get a definition in `node` by `identifier`. Supports weird keys (like
4-
`__proto__` or `toString`).
3+
<!--lint disable list-item-spacing heading-increment list-item-indent-->
4+
5+
<!--lint disable no-duplicate-headings-->
6+
7+
Get definitions in [MDAST][] nodes by `identifier`. Supports funky
8+
keys, like `__proto__` or `toString`.
59

610
## Installation
711

8-
[npm](https://docs.npmjs.com/cli/install):
12+
[npm][]:
913

1014
```bash
1115
npm install mdast-util-definitions
1216
```
1317

14-
**mdast-util-definitions** is also available for [duo](http://duojs.org/#getting-started)
15-
and as an AMD, CommonJS, and globals module, ([uncompressed and
16-
compressed](https://github.com/wooorm/mdast-util-definitions/releases)).
18+
**mdast-util-definitions** is also available as an AMD, CommonJS, and
19+
globals module, [uncompressed and compressed][releases].
1720

1821
## Usage
1922

@@ -23,37 +26,67 @@ var definitions = require('mdast-util-definitions');
2326

2427
var ast = remark().parse('[example]: http://example.com "Example"');
2528

26-
var getDefinition = definitions(ast);
29+
var definition = definitions(ast);
2730

28-
getDefinition('example');
31+
definition('example');
2932
// {type: 'definition', 'title': 'Example', ...}
3033

31-
getDefinition('foo');
34+
definition('foo');
3235
// null
3336
```
3437

3538
## API
3639

37-
### `getDefinitionFactory(node): getDefinition`
40+
### `definitions(node)`
3841

3942
Create a cache of all `definition`s in `node`.
4043

41-
Parameters:
44+
###### Parameters
4245

43-
* `node` (`Node`) — (Grand)parent of definitions.
46+
* `node` ([`Node`][node]) — Ancestor of definitions.
4447

45-
Returns: `Function` — See [`getDefinition`](#getdefinitionidentifier)
48+
###### Returns
4649

47-
### `getDefinition(identifier)`
50+
[`Function`][definition]
4851

49-
Get a definition by `identifier`.
52+
### `definition(identifier)`
5053

51-
Parameters:
54+
###### Parameters
5255

5356
* `identifier` (`string`) — Identifier of definition.
5457

55-
Returns: `Node?` — Definition, if found.
58+
###### Returns
59+
60+
[`Node?`][node] — Definition, if found.
5661

5762
## License
5863

59-
[MIT](LICENSE) [@](https://github.com/) [Titus Wormer](http://wooorm.com)
64+
[MIT][license] © [Titus Wormer][author]
65+
66+
<!-- Definitions -->
67+
68+
[build-badge]: https://img.shields.io/travis/wooorm/mdast-util-definitions.svg
69+
70+
[build-status]: https://travis-ci.org/wooorm/mdast-util-definitions
71+
72+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/mdast-util-definitions.svg
73+
74+
[coverage-status]: https://codecov.io/github/wooorm/mdast-util-definitions
75+
76+
[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg
77+
78+
[chat]: https://gitter.im/wooorm/remark
79+
80+
[releases]: https://github.com/wooorm/mdast-util-definitions/releases
81+
82+
[license]: LICENSE
83+
84+
[author]: http://wooorm.com
85+
86+
[npm]: https://docs.npmjs.com/cli/install
87+
88+
[mdast]: https://github.com/wooorm/mdast
89+
90+
[node]: https://github.com/wooorm/mdast#node
91+
92+
[definition]: #definitionidentifier

0 commit comments

Comments
 (0)