Skip to content

Commit 1a88659

Browse files
docs(readme): update usage and options documentation
1 parent a86f694 commit 1a88659

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

readme.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# unified-message-control [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat]
22

3-
Enable, disable, and ignore messages with [**remark**][remark].
3+
Enable, disable, and ignore messages with [**unified**][unified].
44

55
## Installation
66

77
[npm][]:
88

99
```bash
10-
npm install remark-message-control
10+
npm install unified-message-control
1111
```
1212

1313
## Usage
@@ -26,11 +26,12 @@ And our script, `example.js`, looks as follows:
2626
var vfile = require('to-vfile');
2727
var report = require('vfile-reporter');
2828
var remark = require('remark');
29-
var control = require('remark-message-control');
29+
var control = require('unified-message-control');
30+
var mdastMarker = require('mdast-comment-marker');
3031

3132
remark()
3233
.use(warn)
33-
.use(control, {name: 'foo'})
34+
.use(control, {name: 'foo', marker: mdastMarker, test: 'html'})
3435
.process(vfile.readSync('example.md'), function (err, file) {
3536
console.error(report(err || file));
3637
});
@@ -50,7 +51,7 @@ example.md: no issues found
5051

5152
## API
5253

53-
### `remark.use(control, options)`
54+
### `unified.use(control, options)`
5455

5556
Let comment markers control messages from a certain sources.
5657

@@ -66,6 +67,20 @@ For example, `{name: 'alpha'}` controls `alpha` markers:
6667
<!--alpha ignore-->
6768
```
6869

70+
###### `options.marker`
71+
72+
`function` — function that returns a [comment marker object][marker]
73+
for a matched comment, and `null` for a non-matched comment.
74+
75+
###### `options.test`
76+
77+
(`Function`, `string`, `Object`, or `Array.<Test>`)
78+
— When `string`, works like passing `function (node) {return
79+
node.type === test}`.
80+
When `array`, checks any one of the subtests pass.
81+
When `object`, checks that all keys in `test` are in `node`,
82+
and that they have (strictly) equal values
83+
6984
###### `options.known`
7085

7186
`Array.<string>`, optional — List of allowed `ruleId`s. When given, a warning
@@ -151,7 +166,7 @@ For example, to turn off certain messages for the next node:
151166

152167
## Contribute
153168

154-
See [`contribute.md` in `remarkjs/remarkjs`][contribute] for ways to get
169+
See [`contribute.md` in `unified/unified`][contribute] for ways to get
155170
started.
156171

157172
This organisation has a [Code of Conduct][coc]. By interacting with this
@@ -167,9 +182,9 @@ repository, organisation, or community you agree to abide by its terms.
167182

168183
[build-status]: https://travis-ci.org/unifiedjs/unified-message-control
169184

170-
[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-message-control.svg
185+
[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-message-control.svg
171186

172-
[coverage-status]: https://codecov.io/github/remarkjs/remark-message-control
187+
[coverage-status]: https://codecov.io/github/unifiedjs/unified-message-control
173188

174189
[chat-badge]: https://img.shields.io/gitter/room/unifiedjs/Lobby.svg
175190

@@ -181,8 +196,10 @@ repository, organisation, or community you agree to abide by its terms.
181196

182197
[npm]: https://docs.npmjs.com/cli/install
183198

184-
[remark]: https://github.com/remarkjs/remark
199+
[marker]: https://github.com/syntax-tree/mdast-comment-marker#marker
200+
201+
[unified]: https://github.com/unifiedjs/unified
185202

186-
[contribute]: https://github.com/remarkjs/remark/blob/master/contributing.md
203+
[contribute]: https://github.com/unifiedjs/unified/blob/master/contributing.md
187204

188-
[coc]: https://github.com/remarkjs/remark/blob/master/code-of-conduct.md
205+
[coc]: https://github.com/unifiedjs/unified/blob/master/code-of-conduct.md

0 commit comments

Comments
 (0)