Skip to content

Commit 74960dc

Browse files
committed
Refactor readme.md
1 parent 4200e91 commit 74960dc

File tree

1 file changed

+64
-30
lines changed

1 file changed

+64
-30
lines changed

Diff for: readme.md

+64-30
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1-
# mdast-util-position [![Build Status](https://img.shields.io/travis/wooorm/mdast-util-position.svg)](https://travis-ci.org/wooorm/mdast-util-position) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/mdast-util-position.svg)](https://codecov.io/github/wooorm/mdast-util-position)
1+
# mdast-util-position [![Build Status][travis-badge]][travis] [![Coverage Status][coverage-badge]][coverage]
22

3-
[**mdast**](https://github.com/wooorm/mdast) utility to get the position
4-
of nodes.
3+
[**mdast**][mdast] utility to get the position of nodes.
54

65
* Supports index-based positional information patched by
7-
[**mdast-range**](https://github.com/wooorm/mdast-range);
6+
[**mdast-range**][mdast-range];
87

9-
* Supports [`indent`](https://github.com/wooorm/mdast#location).
8+
* Supports [`indent`][mdast-indent].
9+
10+
Utility to get the style of an [**mdast**][mdast] heading.
1011

1112
## Installation
1213

13-
[npm](https://docs.npmjs.com/cli/install):
14+
[npm][npm-install]:
1415

1516
```bash
1617
npm install mdast-util-position
1718
```
1819

19-
**mdast-util-position** is also available for [duo](http://duojs.org/#getting-started),
20-
and as an AMD, CommonJS, and globals module, [uncompressed and
21-
compressed](https://github.com/wooorm/mdast-util-position/releases).
20+
**mdast-util-position** is also available for [duo][],
21+
and as an AMD, CommonJS, and globals module,
22+
[uncompressed and compressed][releases].
2223

2324
## Usage
2425

2526
```js
26-
var mdast = require('mdast');
27+
var remark = require('remark');
2728
var position = require('mdast-util-position');
2829

29-
var ast = mdast.parse(`# foo
30-
31-
* bar
32-
`);
30+
var ast = remark.parse([
31+
'# foo',
32+
'',
33+
'* bar',
34+
''
35+
].join('\n'));
3336

3437
position.start(ast) // {line: 1, column: 1}
3538
position.end(ast) // {line: 4, column: 1}
@@ -42,30 +45,61 @@ position.generated() // true
4245

4346
## API
4447

45-
### position.start(node?)
48+
### `position.start([node])`
49+
50+
### `position.end([node])`
4651

47-
### position.end(node?)
52+
Get the heading style of a node.
4853

49-
Parameters:
54+
**Parameters**:
5055

51-
* `node` (optional [`Node`](https://github.com/wooorm/mdast/blob/master/doc/nodes.md#node))
52-
— Node to check
56+
* `node` ([`Node`][mdast-node]) — Node to check;
5357

54-
Returns: [`Position`](https://github.com/wooorm/mdast/blob/master/doc/nodes.md#position)
55-
— Filled with `line` (nullable `uint32 >= 1`) and `column` (nullable
56-
`uint32 >= 1`).
58+
**Returns** ([`Position`][mdast-position]) — Filled with `line`
59+
(nullable `uint32 >= 1`) and `column` (nullable `uint32 >= 1`).
5760

58-
### position.generated(node?)
61+
### `position.generated([node])`
5962

60-
Parameters:
63+
Get the heading style of a node.
6164

62-
* `node` (optional [`Node`](https://github.com/wooorm/mdast/blob/master/doc/nodes.md#node))
63-
— Node to check
65+
**Parameters**:
6466

65-
Returns: `boolean`, whether or not `node` has positional information (both
66-
starting and ending lines and columns). This is useful when checking if a node
67-
is inserted by plug-ins.
67+
* `node` ([`Node`][mdast-node]) — Node to check;
68+
69+
**Returns** (`boolean`) — Whether or not `node` has positional
70+
information (both starting and ending lines and columns). This is
71+
useful when checking if a node is inserted by plug-ins.
6872

6973
## License
7074

71-
[MIT](LICENSE) © [Titus Wormer](http://wooorm.com)
75+
[MIT][license] © [Titus Wormer][home]
76+
77+
<!-- Definitions -->
78+
79+
[travis-badge]: https://img.shields.io/travis/wooorm/mdast-util-position.svg
80+
81+
[travis]: https://travis-ci.org/wooorm/mdast-util-position
82+
83+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/mdast-util-position.svg
84+
85+
[coverage]: https://codecov.io/github/wooorm/mdast-util-position
86+
87+
[mdast]: https://github.com/wooorm/mdast
88+
89+
[mdast-node]: https://github.com/wooorm/mdast#node
90+
91+
[mdast-range]: https://github.com/wooorm/mdast-range
92+
93+
[mdast-indent]: https://github.com/wooorm/mdast#location
94+
95+
[mdast-position]: https://github.com/wooorm/mdast/blob/master/doc/nodes.md#position
96+
97+
[npm-install]: https://docs.npmjs.com/cli/install
98+
99+
[duo]: http://duojs.org/#getting-started
100+
101+
[releases]: https://github.com/wooorm/mdast-util-position/releases
102+
103+
[license]: LICENSE
104+
105+
[home]: http://wooorm.com

0 commit comments

Comments
 (0)